﻿model droneCtrl
  extends ModelWorkspace;
  import SysplorerEmbeddedCoder.Types.*;
  import BaseWorkspace.*;
  annotation(__MWORKS(version="2025b",modelType=Control,PortArrangement,BlockSystem(blockKind=BlockKind.userModel,SampleTime(auto=true,group="")=1,OutputInterval=1),SysblockVersion="1.0"),Icon(coordinateSystem(preserveAspectRatio=false)),experiment(Algorithm=Esdirk34,Interval=-1,InlineIntegrator=false,InlineStepSize=false,StartTime=0,StopTime=50,StoreEventValue=0,Tolerance=0.0001),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
grid={2,2}),graphics = {Text(origin={-82,-16},
lineColor={0,0,0},
extent={{-20,-10},{20,10}},
textString="水平和高度控制",
fontSize=14,
textStyle={TextStyle.None},
textColor={0,0,0}), Text(origin={108,-24.4},
lineColor={0,0,0},
extent={{-20,-10},{20,10}},
textString="姿态控制",
fontSize=14,
textStyle={TextStyle.None},
textColor={0,0,0}), Text(origin={376,-70},
lineColor={0,0,0},
extent={{-20,-10},{20,10}},
textString="无人机简单模型",
fontSize=14,
textStyle={TextStyle.None},
textColor={0,0,0})}));
  block SubSystem "选择子系统模块的设置。 要启用涉及代码生成的相关参数, 请选择 '视为原子单元' 。"

    SysplorerEmbeddedCoder.Port.Inport z_d 
      annotation (Placement(transformation(origin={-96,-0.845782},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,100},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.Port.Outport Thrust_desire 
      annotation (Placement(transformation(origin={132,-15.2305},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,96},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.MathOperation.Gain gain(k=-1) 
      annotation (Placement(transformation(origin={-58,-0.845777},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
    SubSystem subSystem 
      annotation (Placement(transformation(origin={29.5,-15.2305},
extent={{-26.5,-21.5771},{26.5,21.5771115}})),__MWORKS(PortLabels(labelType="PortName")));
    SysplorerEmbeddedCoder.SignalRouting.DeMux deMux(portNumber=3) 
      annotation (Placement(transformation(origin={134,-302},
extent={{-2,-20},{2,20}},
rotation=180)),__MWORKS(BlockSystem(Instance(y(y1(Type(ref="double"),Dimension=1),y2(Type(ref="double"),Dimension=1),y3(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=[3])),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.Port.Inport pos_act 
      annotation (Placement(transformation(origin={188,-303},
extent={{-10,-10},{10,10}},
rotation=180),
iconTransformation(origin={-301.8,60},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=[3])));
    SysplorerEmbeddedCoder.SignalRouting.DeMux deMux1(portNumber=3) 
      annotation (Placement(transformation(origin={224,-232},
extent={{-2,-20},{2,20}},
rotation=180)),__MWORKS(BlockSystem(Instance(y(y1(Type(ref="double"),Dimension=1),y2(Type(ref="double"),Dimension=1),y3(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=[3])),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.Port.Inport v_act 
      annotation (Placement(transformation(origin={278,-233},
extent={{-10,-10},{10,10}},
rotation=180),
iconTransformation(origin={-301.8,20},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=[3])));
    SysplorerEmbeddedCoder.Port.Inport x_d 
      annotation (Placement(transformation(origin={22,-73.4038},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,-20},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.Port.Inport y_d 
      annotation (Placement(transformation(origin={22,-120},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,-60},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.MathOperation.Sum sum1(isSaturate=false,inputs="+-") 
      annotation (Placement(transformation(origin={82,-78.4038},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap),SampleTime(group="D0")=0),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
    SysplorerEmbeddedCoder.MathOperation.Sum sum2(isSaturate=false,inputs="+-") 
      annotation (Placement(transformation(origin={180,-83.4038},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap),SampleTime(group="D0")=0),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
    SysplorerEmbeddedCoder.Discontinuities.Saturation saturation(upLimit=1,lowLimit=-1) 
      annotation (Placement(transformation(origin={232,-83.4038},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(dynamicSaturation(upperLimit(Type(ref="double"),Dimension=1),u(Type(ref="double"),Dimension=1),lowerLimit(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),constant_up(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),constant_low(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),upLimit(Type(ref="double"),Dimension=1),lowLimit(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.MathOperation.Sum sum3(isSaturate=false,inputs="+-") 
      annotation (Placement(transformation(origin={104,-125},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap),SampleTime(group="D0")=0),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
    SysplorerEmbeddedCoder.MathOperation.Gain gain2 
      annotation (Placement(transformation(origin={156,-125},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.MathOperation.Sum sum4(isSaturate=false,inputs="+-") 
      annotation (Placement(transformation(origin={202,-130},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap),SampleTime(group="D0")=0),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
    SysplorerEmbeddedCoder.Discontinuities.Saturation saturation1(upLimit=1,lowLimit=-1) 
      annotation (Placement(transformation(origin={254,-130},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(dynamicSaturation(upperLimit(Type(ref="double"),Dimension=1),u(Type(ref="double"),Dimension=1),lowerLimit(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),constant_up(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),constant_low(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),upLimit(Type(ref="double"),Dimension=1),lowLimit(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.Continuous.PIDController pIDController(externalResetType=SysplorerEmbeddedCoder.Discrete.DiscretePIDController.ExternalResetType.None,controllerParameterI=0,controllerParameterP=4.2) 
      annotation (Placement(transformation(origin={315,-83.4038},
extent={{-19,-14.2981},{19,14.2981}})),__MWORKS(BlockSystem(Instance(u1(Type(ref="double"),Dimension=1),PassThrough1(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),IdeallProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),ParallelProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),IProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),ISum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),NDProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),DSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),FilterProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Opposite(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),PIDSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1),u4(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),SatSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),PassThrough3(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),PGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),IGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),DGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),NGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),outport(Type(ref="double"),Dimension=1),OneConstant2(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),TRGround(y(Type(ref="double"
),Dimension=1)),KBGround(y(Type(ref="double"),Dimension=1)),GroundSat(y(Type(ref="double"),Dimension=1)),controllerParameterP(Type(ref=""),Dimension=1),controllerParameterI(Type(ref=""),Dimension=1),controllerParameterD(Type(ref=""),Dimension=1),N(Type(ref=""),Dimension=1),initialConditionForIntegrator(Type(ref=""),Dimension=1),initialConditionForDifferentiator(Type(ref=""),Dimension=1),Integrator(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),Filter(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1))),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.Continuous.PIDController pIDController1(externalResetType=SysplorerEmbeddedCoder.Discrete.DiscretePIDController.ExternalResetType.None,controllerParameterI=0,controllerParameterP=4.2) 
      annotation (Placement(transformation(origin={329,-130},
extent={{-19,-14.2981},{19,14.2981}})),__MWORKS(BlockSystem(Instance(u1(Type(ref="double"),Dimension=1),PassThrough1(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),IdeallProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),ParallelProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),IProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),ISum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),NDProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),DSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),FilterProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Opposite(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),PIDSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1),u4(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),SatSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),PassThrough3(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),PGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),IGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),DGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),NGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),outport(Type(ref="double"),Dimension=1),OneConstant2(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),TRGround(y(Type(ref="double"
),Dimension=1)),KBGround(y(Type(ref="double"),Dimension=1)),GroundSat(y(Type(ref="double"),Dimension=1)),controllerParameterP(Type(ref=""),Dimension=1),controllerParameterI(Type(ref=""),Dimension=1),controllerParameterD(Type(ref=""),Dimension=1),N(Type(ref=""),Dimension=1),initialConditionForIntegrator(Type(ref=""),Dimension=1),initialConditionForDifferentiator(Type(ref=""),Dimension=1),Integrator(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),Filter(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1))),SampleTime(group="D0")=0)));
    JuliaFunction juliaFunction 
      annotation (Placement(transformation(origin={459,-121.56005},
extent={{-25,-50.875},{25,50.875}})),__MWORKS(BlockSystem(SampleTime=-1)));
    SysplorerEmbeddedCoder.Port.Inport euler_act 
      annotation (Placement(transformation(origin={470,-239.833},
extent={{-10,-10},{10,10}},
rotation=180),
iconTransformation(origin={-301.8,-100},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=[3])));
    SysplorerEmbeddedCoder.SignalRouting.DeMux deMux2(portNumber=3) 
      annotation (Placement(transformation(origin={404,-239.833},
extent={{-2,-40.1667},{2,40.1667}},
rotation=180)),__MWORKS(BlockSystem(Instance(y(y1(Type(ref="double"),Dimension=1),y2(Type(ref="double"),Dimension=1),y3(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=[3])),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.Port.Outport roll_act 
      annotation (Placement(transformation(origin={338,-266.611},
extent={{-10,-10},{10,10}},
rotation=180),
iconTransformation(origin={301.8,48},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.Port.Outport pitch_act 
      annotation (Placement(transformation(origin={334,-239.833},
extent={{-10,-10},{10,10}},
rotation=180),
iconTransformation(origin={301.8,0},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.MathOperation.Gain gain3(k=180/pi) 
      annotation (Placement(transformation(origin={538,-96.12255},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.MathOperation.Gain gain4(k=180/pi) 
      annotation (Placement(transformation(origin={552,-146.99755},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.Discontinuities.Saturation saturation2(upLimit=10,lowLimit=-10) 
      annotation (Placement(transformation(origin={614,-96.12255},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(dynamicSaturation(upperLimit(Type(ref="double"),Dimension=1),u(Type(ref="double"),Dimension=1),lowerLimit(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),constant_up(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),constant_low(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),upLimit(Type(ref="double"),Dimension=1),lowLimit(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.Discontinuities.Saturation saturation3(upLimit=10,lowLimit=-10) 
      annotation (Placement(transformation(origin={650,-146.99755},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(dynamicSaturation(upperLimit(Type(ref="double"),Dimension=1),u(Type(ref="double"),Dimension=1),lowerLimit(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),constant_up(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),constant_low(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),upLimit(Type(ref="double"),Dimension=1),lowLimit(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.Port.Outport roll_d 
      annotation (Placement(transformation(origin={696,-96.1226},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-48},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.Port.Outport pitch_d 
      annotation (Placement(transformation(origin={720,-146.998},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-96},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.Sources.Constant constant1(k=PosDyna_GravityAcc) 
      annotation (Placement(transformation(origin={316,-164.43505},
extent={{-32,-8},{32,8}})),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));
    SysplorerEmbeddedCoder.Continuous.PIDController pIDController2(externalResetType=SysplorerEmbeddedCoder.Discrete.DiscretePIDController.ExternalResetType.None,controllerParameterI=0) 
      annotation (Placement(transformation(origin={128,-78.4038},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Type(ref="double"),Dimension=1),PassThrough1(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),IdeallProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),ParallelProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),IProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),ISum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),NDProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),DSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),FilterProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Opposite(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),PIDSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1),u4(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),SatSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),PassThrough3(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),PGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),IGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),DGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),NGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),outport(Type(ref="double"),Dimension=1),OneConstant2(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),TRGround(y(Type(ref="double"
),Dimension=1)),KBGround(y(Type(ref="double"),Dimension=1)),GroundSat(y(Type(ref="double"),Dimension=1)),controllerParameterP(Type(ref=""),Dimension=1),controllerParameterI(Type(ref=""),Dimension=1),controllerParameterD(Type(ref=""),Dimension=1),N(Type(ref=""),Dimension=1),initialConditionForIntegrator(Type(ref=""),Dimension=1),initialConditionForDifferentiator(Type(ref=""),Dimension=1),Integrator(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),Filter(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1))),SampleTime(group="D0")=0)));
    annotation (defaultComponentName="subSystem", __MWORKS(PortArrangement(Left(z_d, pos_act, v_act, x_d, y_d, euler_act), Right(Thrust_desire, roll_act, pitch_act, roll_d, pitch_d)),BlockSystem(blockKind=BlockKind.subSystem, SampleTime(auto=true), SubSystem(virtual=true, functionPack=FunctionPack.auto, functionName="", sourceFile="")),PortLabels(labelType="PortName"),sourceModel=SysplorerEmbeddedCoder.SubSystems.SubSystem,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-300,-120},{300,120}},
  grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
  rotationPolicy=RotationPolicy.Follow,
  origin={0,0},
  fillColor={255,255,255},
  fillPattern=FillPattern.Solid,
  lineThickness=3,
  extent={{-300,120},{300,-120}}), Text(origin={0,-140},
  lineColor={0,0,0},
  extent={{0,-20},{0,20}},
  textString="%name",
  fontSize=14,
  textStyle={TextStyle.None},
  textColor={0,0,0},
  verticalAlignment=TextAlignment.Top)},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
grid={2,2})));
    block SubSystem "选择子系统模块的设置。 要启用涉及代码生成的相关参数, 请选择 '视为原子单元' 。"

      SysplorerEmbeddedCoder.Port.Inport z_d 
        annotation (Placement(transformation(origin={-130,-0.845782},
  extent={{-10,-10},{10,10}}),
  iconTransformation(origin={-301.8,80},
  extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Outport thrust_d 
        annotation (Placement(transformation(origin={392,-15.8458},
  extent={{-10,-10},{10,10}}),
  iconTransformation(origin={301.8,0},
  extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(Type(inherit=InheritType.auto,ref="double"),Dimension(dimensionType=DimensionType.auto)=1,SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.MathOperation.Sum sum1(isSaturate=false,inputs="+-") 
        annotation (Placement(transformation(origin={-80,-5.84578},
  extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap),SampleTime(group="D0")=0),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
      SysplorerEmbeddedCoder.Port.Inport z_act 
        annotation (Placement(transformation(origin={-130,-50},
  extent={{-10,-10},{10,10}}),
  iconTransformation(origin={-301.8,0},
  extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.MathOperation.Gain gain(k=2) 
        annotation (Placement(transformation(origin={-40,-5.84578},
  extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Discontinuities.Saturation saturation(upLimit=5,lowLimit=-5) 
        annotation (Placement(transformation(origin={14,-5.84578},
  extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(dynamicSaturation(upperLimit(Type(ref="double"),Dimension=1),u(Type(ref="double"),Dimension=1),lowerLimit(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),constant_up(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),constant_low(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),upLimit(Type(ref="double"),Dimension=1),lowLimit(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.MathOperation.Sum sum2(isSaturate=false,inputs="+-") 
        annotation (Placement(transformation(origin={74,-10.8458},
  extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap),SampleTime(group="D0")=0),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
      SysplorerEmbeddedCoder.Port.Inport vz_act 
        annotation (Placement(transformation(origin={30,-60},
  extent={{-10,-10},{10,10}}),
  iconTransformation(origin={-301.8,-80},
  extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Continuous.PIDController pIDController(externalResetType=SysplorerEmbeddedCoder.Discrete.DiscretePIDController.ExternalResetType.None,controllerParameterD=1.89,controllerParameterI=12.06,controllerParameterP=10.7) 
        annotation (Placement(transformation(origin={122,-10.8458},
  extent={{-16,-10},{16,10}})),__MWORKS(BlockSystem(Instance(u1(Type(ref="double"),Dimension=1),PassThrough1(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),IdeallProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),ParallelProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),IProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),ISum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),NDProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),DSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),FilterProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Opposite(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),PIDSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1),u4(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),SatSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),PassThrough3(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),PGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),IGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),DGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),NGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),outport(Type(ref="double"),Dimension=1),OneConstant2(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),TRGround(y(Type(ref="double"
),Dimension=1)),KBGround(y(Type(ref="double"),Dimension=1)),GroundSat(y(Type(ref="double"),Dimension=1)),controllerParameterP(Type(ref=""),Dimension=1),controllerParameterI(Type(ref=""),Dimension=1),controllerParameterD(Type(ref=""),Dimension=1),N(Type(ref=""),Dimension=1),initialConditionForIntegrator(Type(ref=""),Dimension=1),initialConditionForDifferentiator(Type(ref=""),Dimension=1),Integrator(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),Filter(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1))),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Discontinuities.Saturation saturation1(upLimit=1,lowLimit=-1) 
        annotation (Placement(transformation(origin={180,-10.8458},
  extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(dynamicSaturation(upperLimit(Type(ref="double"),Dimension=1),u(Type(ref="double"),Dimension=1),lowerLimit(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),constant_up(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),constant_low(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),upLimit(Type(ref="double"),Dimension=1),lowLimit(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.MathOperation.Sum sum3(isSaturate=false,inputs="+-") 
        annotation (Placement(transformation(origin={232,-15.8458},
  extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap),SampleTime(group="D0")=0),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
      SysplorerEmbeddedCoder.Sources.Constant constant1(k=0.60899) 
        annotation (Placement(transformation(origin = {180, -60}, extent = {{-10, -10}, {10, 10}})),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));
      SysplorerEmbeddedCoder.MathOperation.Gain gain1(k=-1) 
        annotation (Placement(transformation(origin={280,-15.8458},
  extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Discontinuities.Saturation saturation2(upLimit=1,lowLimit=0) 
        annotation (Placement(transformation(origin={328,-15.8458},
  extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(dynamicSaturation(upperLimit(Type(ref="double"),Dimension=1),u(Type(ref="double"),Dimension=1),lowerLimit(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),constant_up(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),constant_low(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),upLimit(Type(ref="double"),Dimension=1),lowLimit(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));

      annotation (defaultComponentName="subSystem", __MWORKS(PortArrangement(Left(z_d, z_act, vz_act), Right(thrust_d)),BlockSystem(blockKind=BlockKind.subSystem, SampleTime(auto=true), SubSystem(virtual=true, functionPack=FunctionPack.auto, functionName="", sourceFile="")),PortLabels(labelType="PortName"),sourceModel=SysplorerEmbeddedCoder.SubSystems.SubSystem,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-300,-120},{300,120}},
    grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
    rotationPolicy=RotationPolicy.Follow,
    origin={0,0},
    fillColor={255,255,255},
    fillPattern=FillPattern.Solid,
    lineThickness=3,
    extent={{-300,120},{300,-120}}), Text(origin={0,-140},
    lineColor={0,0,0},
    extent={{0,-20},{0,20}},
    textString="%name",
    fontSize=14,
    textStyle={TextStyle.None},
    textColor={0,0,0},
    verticalAlignment=TextAlignment.Top)},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
  grid={2,2})));
    equation
      connect(z_d, sum1.u1) 
      annotation(Line(origin={-105,-1},
      points={{-13,0.154223},{13.2,0.154223}},
      color={0,0,0}));
      connect(z_act, sum1.u2) 
      annotation(Line(origin={-105,-30},
      points={{-13,-20},{9.4,-20},{9.4,19.15422},{13.2,19.15422}},
      color={0,0,0}));
      connect(sum1.y, gain.u) 
      annotation(Line(origin={-60,-6},
      points={{-8.2,0.15422},{8.2,0.15422}},
      color={0,0,0}));
      connect(gain.y, saturation.u) 
      annotation(Line(origin={-13,-6},
      points={{-15.2,0.15422},{15.2,0.15422}},
      color={0,0,0}));
      connect(saturation.y, sum2.u1) 
      annotation(Line(origin={44,-6},
      points={{-18.2,0.15422},{18.2,0.15422}},
      color={0,0,0}));
      connect(vz_act, sum2.u2) 
      annotation(Line(origin={52,-38},
      points={{-9.99997,-22},{6.4,-22},{6.4,22.15422},{10.2,22.15422}},
      color={0,0,0}));
      connect(sum2.y, pIDController.u1) 
      annotation(Line(origin={95,-11},
      points={{-9.2,0.15422},{9.2,0.15422}},
      color={0,0,0}));
      connect(pIDController.outport, saturation1.u) 
      annotation(Line(origin={154,-11},
      points={{-14.2,0.1542},{14.2,0.1542}},
      color={0,0,0}));
      connect(saturation1.y, sum3.u1) 
      annotation(Line(origin={206,-11},
      points={{-14.2,0.1542},{14.2,0.1542}},
      color={0,0,0}));
      connect(constant1.y, sum3.u2) 
      annotation(Line(origin={206,-40},
      points={{-14.2,-20},{10.4,-20},{10.4,19.1542},{14.2,19.1542}},
      color={0,0,0}));
      connect(sum3.y, gain1.u) 
      annotation(Line(origin={256,-16},
      points={{-12.2,0.1542},{12.2,0.1542}},
      color={0,0,0}));
      connect(gain1.y, saturation2.u) 
      annotation(Line(origin={304,-16},
      points={{-12.2,0.1542},{12.2,0.1542}},
      color={0,0,0}));
      connect(thrust_d, saturation2.y) 
      annotation(Line(origin={360,-16},
      points={{20,0.1542},{-20.2,0.1542}},
      color={0,0,0}));
      end SubSystem;
    block JuliaFunction "编辑和调用Julia脚本函数"
        annotation (defaultComponentName = "juliaFunction", __MWORKS(BlockSystem(blockKind=BlockKind.subSystem,bltBlockKind=BltBlockKind.juliaFunctionSystem,Subsystem(virtual=true,functionPack=FunctionPack.auto,functionName="",sourceFile=""),SampleTime(auto = true),SubSystem),PortArrangement(Left(in_v_x,in_v_y,in_act_yaw,in_g),Right(out_roll_d,out_pitch_d)),sourceModel=SysplorerEmbeddedCoder.Utilities.JuliaFunction,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-200,-100},{200,100}},
    grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
    rotationPolicy=RotationPolicy.Follow,
    origin={0,0},
    fillColor={255,255,255},
    fillPattern=FillPattern.Solid,
    lineThickness=3,
    extent={{-200,100},{200,-100}}), Text(origin={0,-75},
    lineColor={0,0,0},
    extent={{-200,20},{200,-20}},
    textString="%juliaFunctionName",
    fontSize=14,
    textStyle={TextStyle.None},
    textColor={0,0,0}), Text(origin={0,-120},
    lineColor={0,0,0},
    extent={{0,-20},{0,20}},
    textString="%name",
    fontSize=14,
    textStyle={TextStyle.None},
    textColor={0,0,0},
    verticalAlignment=TextAlignment.Top), Bitmap(origin={0,0},
    extent={{-40,-40},{40,40}},
    fileName="modelica://SysplorerEmbeddedCoder/Resources/Icons/JuliaFunction.svg")},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
    grid={2,2})),Protection(access=Access.packageDuplicate));

        block JuliaFunctionAtomic
            annotation (__MWORKS(BlockSystem(blockKind=Types.BlockKind.atomic,
                bltBlockKind=Types.BltBlockKind.juliaFunction), hide=true),Protection(access=Access.packageDuplicate));
          SysplorerEmbeddedCoder.Types.InputAuto in_v_x annotation(Placement(transformation(origin={ -240,90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
          SysplorerEmbeddedCoder.Types.InputAuto in_v_y annotation(Placement(transformation(origin={ -240,30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
          SysplorerEmbeddedCoder.Types.InputAuto in_act_yaw annotation(Placement(transformation(origin={ -240,-30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
          SysplorerEmbeddedCoder.Types.InputAuto in_g annotation(Placement(transformation(origin={ -240,-90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
          SysplorerEmbeddedCoder.Types.OutputAuto out_roll_d annotation(Placement(transformation(origin={ -240,30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
          SysplorerEmbeddedCoder.Types.OutputAuto out_pitch_d annotation(Placement(transformation(origin={ -240,-30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
          parameter String juliaScript = "function fcn(v_x,v_y,act_yaw,g)\r\n    A_INV = [sin(act_yaw) -cos(act_yaw);\r\n             cos(act_yaw)  sin(act_yaw)];\r\n    desire_roll_pitch = -1*(1/g) * A_INV * [v_x;v_y]; \r\n    roll_d = desire_roll_pitch[1];\r\n    pitch_d = desire_roll_pitch[2];\r\n    return roll_d,pitch_d;\r\nend" annotation (HideResult = true);
          parameter String juliaObjectName = "fcn" annotation (HideResult = true);
          end JuliaFunctionAtomic;

        JuliaFunctionAtomic juliaFunctionAtomic annotation(HideResult = true,__MWORKS(BlockSystem(Instance(in_v_x(Type(ref="double"),Dimension=1),in_v_y(Type(ref="double"),Dimension=1),in_act_yaw(Type(ref="double"),Dimension=1),in_g(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Types.InputAuto in_v_x annotation(Placement(transformation(origin={ -240,90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
      SysplorerEmbeddedCoder.Types.InputAuto in_v_y annotation(Placement(transformation(origin={ -240,30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
      SysplorerEmbeddedCoder.Types.InputAuto in_act_yaw annotation(Placement(transformation(origin={ -240,-30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
      SysplorerEmbeddedCoder.Types.InputAuto in_g annotation(Placement(transformation(origin={ -240,-90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
      SysplorerEmbeddedCoder.Types.OutputAuto out_roll_d annotation(Placement(transformation(origin={ -240,30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
      SysplorerEmbeddedCoder.Types.OutputAuto out_pitch_d annotation(Placement(transformation(origin={ -240,-30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
      parameter String juliaFunctionName = "fcn" annotation(HideResult = true);
      equation
      connect(in_v_x, juliaFunctionAtomic.in_v_x);
      connect(in_v_y, juliaFunctionAtomic.in_v_y);
      connect(in_act_yaw, juliaFunctionAtomic.in_act_yaw);
      connect(in_g, juliaFunctionAtomic.in_g);
      connect(out_roll_d, juliaFunctionAtomic.out_roll_d);
      connect(out_pitch_d, juliaFunctionAtomic.out_pitch_d);
      end JuliaFunction;
  equation
    connect(z_d, gain.u) 
    annotation(Line(origin={-77,-1},
    points={{-6.99997,0.154223},{7.2,0.154223}},
    color={0,0,0}));
    connect(gain.y, subSystem.z_d) 
    annotation(Line(origin={-22,-1},
    points={{-24.2,0.154223},{23.2,0.154223}},
    color={0,0,0}));
    connect(subSystem.thrust_d, Thrust_desire) 
    annotation(Line(origin={89,-15},
    points={{-31.2,-0.230518},{31,-0.230518}},
    color={0,0,0}));
    connect(deMux.u, pos_act) 
    annotation(Line(origin={157,-303},
points={{-19.2,1},{19,1},{19,-4.8e-6}},
color={0,0,0}));
    connect(deMux1.u, v_act) 
    annotation(Line(origin={247,-233},
points={{-19.2,1},{19,1},{19,-4.8e-6}},
color={0,0,0}));
    connect(x_d, sum1.u1) 
    annotation(Line(origin={52,-73},
    points={{-18,-0.403795},{18.2,-0.403795}},
    color={0,0,0}));
    connect(sum2.y, saturation.u) 
    annotation(Line(origin={206,-83},
    points={{-14.2,-0.4038},{14.2,-0.4038}},
    color={0,0,0}));
    connect(sum3.y, gain2.u) 
    annotation(Line(origin={130,-124.596},
points={{-14.2,-0.4038},{14.2,-0.4038}},
color={0,0,0}));
    connect(gain2.y, sum4.u1) 
    annotation(Line(origin={179,-124.596},
points={{-11.2,-0.4038},{11.2,-0.4038}},
color={0,0,0}));
    connect(sum4.y, saturation1.u) 
    annotation(Line(origin={228,-129.596},
points={{-14.2,-0.4038},{14.2,-0.4038}},
color={0,0,0}));
    connect(y_d, sum3.u1) 
    annotation(Line(origin={63,-120},
    points={{-29,4.8e-6},{29.2,4.8e-6}},
    color={0,0,0}));
    connect(saturation.y, pIDController.u1) 
    annotation(Line(origin={269,-83},
    points={{-25.2,-0.4038},{25.2,-0.4038}},
    color={0,0,0}));
    connect(saturation1.y, pIDController1.u1) 
    annotation(Line(origin={287,-130},
    points={{-21.2,4.8e-6},{21.2,4.8e-6}},
    color={0,0,0}));
    connect(pIDController.outport, juliaFunction.in_v_x) 
    annotation(Line(origin={384,-83},
    points={{-48.2,-0.4038},{48.2,-0.4038}},
    color={0,0,0}));
    connect(pIDController1.outport, juliaFunction.in_v_y) 
    annotation(Line(origin={391,-119},
points={{-41.2,-11},{1,-11},{1,10.1587},{41.2,10.1587}},
color={0,0,0}));
    connect(euler_act, deMux2.u) 
    annotation(Line(origin={418,-219.667},
points={{40,-20.1667},{-10.2,-20.1667}},
color={0,0,0}));
    connect(juliaFunction.out_roll_d, gain3.u) 
    annotation(Line(origin={506,-96},
    points={{-20.2,-0.12255},{20.2,-0.12255}},
    color={0,0,0}));
    connect(juliaFunction.out_pitch_d, gain4.u) 
    annotation(Line(origin={513,-147},
    points={{-27.2,0.00245},{27.2,0.00245}},
    color={0,0,0}));
    connect(saturation2.u, gain3.y) 
    annotation(Line(origin={576,-96},
    points={{26.2,-0.12255},{-26.2,-0.12255}},
    color={0,0,0}));
    connect(gain4.y, saturation3.u) 
    annotation(Line(origin={601,-147},
    points={{-37.2,0.00245},{37.2,0.00245}},
    color={0,0,0}));
    connect(saturation2.y, roll_d) 
    annotation(Line(origin={655,-96},
    points={{-29.2,-0.12255},{29,-0.12255}},
    color={0,0,0}));
    connect(saturation3.y, pitch_d) 
    annotation(Line(origin={685,-147},
    points={{-23.2,0.00245},{23,0.00245}},
    color={0,0,0}));
    connect(constant1.y, juliaFunction.in_g) 
    annotation(Line(origin={391,-162},
    points={{-41.2,-2.43505},{37.4,-2.43505},{37.4,2.2837},{41.2,2.2837}},
    color={0,0,0}));
    connect(pIDController2.u1, sum1.y) 
    annotation(Line(origin={105,-78},
    points={{11.2,-0.4038},{-11.2,-0.4038}},
    color={0,0,0}));
    connect(pIDController2.outport, sum2.u1) 
    annotation(Line(origin={154,-78},
    points={{-14.2,-0.4038},{14.2,-0.4038}},
    color={0,0,0}));
    connect(deMux1.y3, subSystem.vz_act) 
    annotation(Line(origin={109,-124},
points={{111.2,-94.6667},{-153,-94.6667},{-153,94.3848},{-107.8,94.3848}},
color={0,0,0}));
    connect(deMux1.y2, sum4.u2) 
    annotation(Line(origin={203,-183},
    points={{17.2,-49},{-16.6,-49},{-16.6,48},{-12.8,48}},
    color={0,0,0}));
    connect(deMux1.y1, sum2.u2) 
    annotation(Line(origin={192,-167},
    points={{28.2,-78.3333},{-20.4,-78.3333},{-20.4,63.5962},{-27.6,63.5962},{-27.6,78.5962},{-23.8,78.5962}},
    color={0,0,0}));
    connect(deMux.y1, sum1.u2) 
    annotation(Line(origin={98,-199},
    points={{32.2,-116.333},{-31.6,-116.333},{-31.6,115.5962},{-27.8,115.5962}},
    color={0,0,0}));
    connect(deMux.y2, sum3.u2) 
    annotation(Line(origin={109,-216},
    points={{21.2,-86},{-20.6,-86},{-20.6,86},{-16.8,86}},
    color={0,0,0}));
    connect(deMux.y3, subSystem.z_act) 
    annotation(Line(origin={64,-152},
    points={{66.2,-136.667},{-66.6,-136.667},{-66.6,136.77},{-62.8,136.77}},
    color={0,0,0}));
    connect(deMux2.y1, roll_act) 
    annotation(Line(origin={375,-267},
    points={{25.2,0.3892},{-25,0.3892}},
    color={0,0,0}));
    connect(pitch_act, deMux2.y2) 
    annotation(Line(origin={373,-240},
    points={{-27,0.166995},{27.2,0.167}},
    color={0,0,0}));
    connect(deMux2.y3, juliaFunction.in_act_yaw) 
    annotation(Line(origin={414,-174},
    points={{-13.8,-39.0552},{-17.6,-39.0552},{-17.6,39.7212},{18.2,39.7212}},
    color={0,0,0}));
    end SubSystem;
  model ModelWorkspace
    annotation(__MWORKS(hide = true,BlockSystem(blockKind=BlockKind.modelWorkspace)));
  end ModelWorkspace;
  SubSystem subSystem 
    annotation (Placement(transformation(origin={-82,30},
extent={{-28,-42},{28,42}})),__MWORKS(PortLabels(labelType="PortName")));
  SubSystem1 subSystem1 
    annotation (Placement(transformation(origin={108,18},
extent={{-36,-36},{36,36}})),__MWORKS(PortLabels(labelType="PortName")));
  SysplorerEmbeddedCoder.Sources.Step step(stepTime=15,initialValue=0,finalValue=0) 
    annotation (Placement(transformation(origin={16,18},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(SampleTime(auto=false)=0,Instance(initialValue(Type(ref="double"),Dimension=1),finalValue(Type(ref="double"),Dimension=1),y(Dimension=1),stepTime(Dimension=1)))));
  JuliaFunction juliaFunction 
    annotation (Placement(transformation(origin={201,28.45},
extent={{-15,-46.45},{15,46.45}})),__MWORKS(BlockSystem(SampleTime=-1)));
  SysplorerEmbeddedCoder.SignalRouting.Mux mux(portNumber=4) 
    annotation (Placement(transformation(origin={276,28.45},
extent={{-2,-46.45},{2,46.45}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1),u4(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=[4])),SampleTime(group="D0")=0)));
  SubSystem2 subSystem2 
    annotation (Placement(transformation(origin={376,28.45},
extent={{-58,-90},{58,90}})),__MWORKS(PortLabels(labelType="PortName")));
  Scope scope 
    annotation (Placement(transformation(origin={528,100},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Type(ref="double"),Dimension=[3])),SampleTime(group="D0")=0)));
  SubSystem3 subSystem3 
    annotation (Placement(transformation(origin={-292,14.3333},
extent={{-28,-34},{28,34}})),__MWORKS(PortLabels(labelType="PortName")));
  block SubSystem1 "选择子系统模块的设置。 要启用涉及代码生成的相关参数, 请选择 '视为原子单元' 。"

    SysplorerEmbeddedCoder.Port.Inport roll_deg_d 
      annotation (Placement(transformation(origin={-112,-0.845782},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,96},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.Port.Outport roll_pwm 
      annotation (Placement(transformation(origin={228,-10.8458},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,80},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.MathOperation.Gain gain(k=pi/180) 
      annotation (Placement(transformation(origin={-68,-0.845777},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.MathOperation.Sum sum1(isSaturate=false,inputs="+-") 
      annotation (Placement(transformation(origin={-20,-5.845777},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap),SampleTime(group="D0")=0),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
    SysplorerEmbeddedCoder.MathOperation.Gain roll_kp(k=30) 
      annotation (Placement(transformation(origin={28,-5.845777},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.MathOperation.Sum sum2(isSaturate=false,inputs="+-") 
      annotation (Placement(transformation(origin={76,-10.845777},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap),SampleTime(group="D0")=0),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
    SysplorerEmbeddedCoder.Continuous.PIDController pIDController(externalResetType=SysplorerEmbeddedCoder.Discrete.DiscretePIDController.ExternalResetType.None,controllerParameterI=1.4,controllerParameterP=0.3,controllerParameterD=0.01) 
      annotation (Placement(transformation(origin={128,-10.8458},
extent={{-14,-17.5771},{14,17.5771}})),__MWORKS(BlockSystem(Instance(u1(Type(ref="double"),Dimension=1),PassThrough1(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),IdeallProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),ParallelProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),IProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),ISum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),NDProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),DSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),FilterProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Opposite(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),PIDSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1),u4(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),SatSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),PassThrough3(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),PGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),IGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),DGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),NGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),outport(Type(ref="double"),Dimension=1),OneConstant2(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),TRGround(y(Type(ref="double"
),Dimension=1)),KBGround(y(Type(ref="double"),Dimension=1)),GroundSat(y(Type(ref="double"),Dimension=1)),controllerParameterP(Type(ref=""),Dimension=1),controllerParameterI(Type(ref=""),Dimension=1),controllerParameterD(Type(ref=""),Dimension=1),N(Type(ref=""),Dimension=1),initialConditionForIntegrator(Type(ref=""),Dimension=1),initialConditionForDifferentiator(Type(ref=""),Dimension=1),Integrator(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),Filter(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1))),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.Discontinuities.Saturation saturation(upLimit=1,lowLimit=-1,zeroCross=true) 
      annotation (Placement(transformation(origin={172,-10.8458},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(dynamicSaturation(upperLimit(Type(ref="double"),Dimension=1),u(Type(ref="double"),Dimension=1),lowerLimit(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),constant_up(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),constant_low(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),upLimit(Type(ref="double"),Dimension=1),lowLimit(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0,zeroCross=true)));
    SysplorerEmbeddedCoder.Port.Inport pitch_deg_d 
      annotation (Placement(transformation(origin={-80,-67.7885},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,48},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.Port.Outport pitch_pwm 
      annotation (Placement(transformation(origin={260,-77.7886},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,0},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.MathOperation.Gain gain1(k=pi/180) 
      annotation (Placement(transformation(origin={-36,-67.7885},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.MathOperation.Sum sum3(isSaturate=false,inputs="+-") 
      annotation (Placement(transformation(origin={12,-72.7885},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap),SampleTime(group="D0")=0),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
    SysplorerEmbeddedCoder.MathOperation.Gain pitch_kp(k=30) 
      annotation (Placement(transformation(origin={60,-72.7885},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.MathOperation.Sum sum4(isSaturate=false,inputs="+-") 
      annotation (Placement(transformation(origin={108,-77.7885},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap),SampleTime(group="D0")=0),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
    SysplorerEmbeddedCoder.Continuous.PIDController pIDController1(externalResetType=SysplorerEmbeddedCoder.Discrete.DiscretePIDController.ExternalResetType.None,controllerParameterD=0.01,controllerParameterI=1.4,controllerParameterP=0.3) 
      annotation (Placement(transformation(origin={160,-77.7886},
extent={{-14,-17.5771},{14,17.5771}})),__MWORKS(BlockSystem(Instance(u1(Type(ref="double"),Dimension=1),PassThrough1(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),IdeallProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),ParallelProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),IProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),ISum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),NDProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),DSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),FilterProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Opposite(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),PIDSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1),u4(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),SatSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),PassThrough3(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),PGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),IGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),DGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),NGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),outport(Type(ref="double"),Dimension=1),OneConstant2(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),TRGround(y(Type(ref="double"
),Dimension=1)),KBGround(y(Type(ref="double"),Dimension=1)),GroundSat(y(Type(ref="double"),Dimension=1)),controllerParameterP(Type(ref=""),Dimension=1),controllerParameterI(Type(ref=""),Dimension=1),controllerParameterD(Type(ref=""),Dimension=1),N(Type(ref=""),Dimension=1),initialConditionForIntegrator(Type(ref=""),Dimension=1),initialConditionForDifferentiator(Type(ref=""),Dimension=1),Integrator(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),Filter(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1))),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.Discontinuities.Saturation saturation1(upLimit=1,lowLimit=-1,zeroCross=true) 
      annotation (Placement(transformation(origin={204,-77.7886},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(dynamicSaturation(upperLimit(Type(ref="double"),Dimension=1),u(Type(ref="double"),Dimension=1),lowerLimit(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),constant_up(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),constant_low(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),upLimit(Type(ref="double"),Dimension=1),lowLimit(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0,zeroCross=true)));
    SysplorerEmbeddedCoder.Port.Inport yaw_deg_d 
      annotation (Placement(transformation(origin={-50,-134.731},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,0},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.Port.Outport yaw_pwm 
      annotation (Placement(transformation(origin={290,-144.731},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-80},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.MathOperation.Gain gain2(k=pi/180) 
      annotation (Placement(transformation(origin={-6,-134.731},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.MathOperation.Sum sum5(isSaturate=false,inputs="+-") 
      annotation (Placement(transformation(origin={42,-139.731},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap),SampleTime(group="D0")=0),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
    SysplorerEmbeddedCoder.MathOperation.Gain yaw_kp(k=1) 
      annotation (Placement(transformation(origin={90,-139.731},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.MathOperation.Sum sum6(isSaturate=false,inputs="+-") 
      annotation (Placement(transformation(origin={138,-144.731},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap),SampleTime(group="D0")=0),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
    SysplorerEmbeddedCoder.Continuous.PIDController pIDController2(externalResetType=SysplorerEmbeddedCoder.Discrete.DiscretePIDController.ExternalResetType.None,controllerParameterD=0.1,controllerParameterI=0,controllerParameterP=20) 
      annotation (Placement(transformation(origin={190,-144.731},
extent={{-14,-17.5771},{14,17.5771}})),__MWORKS(BlockSystem(Instance(u1(Type(ref="double"),Dimension=1),PassThrough1(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),IdeallProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),ParallelProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),IProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),ISum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),NDProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),DSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),FilterProduct(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),Opposite(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),PIDSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1),u4(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),SatSum(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),PassThrough3(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),PGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),IGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),DGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),NGain(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),outport(Type(ref="double"),Dimension=1),OneConstant2(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),TRGround(y(Type(ref="double"
),Dimension=1)),KBGround(y(Type(ref="double"),Dimension=1)),GroundSat(y(Type(ref="double"),Dimension=1)),controllerParameterP(Type(ref=""),Dimension=1),controllerParameterI(Type(ref=""),Dimension=1),controllerParameterD(Type(ref=""),Dimension=1),N(Type(ref=""),Dimension=1),initialConditionForIntegrator(Type(ref=""),Dimension=1),initialConditionForDifferentiator(Type(ref=""),Dimension=1),Integrator(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),Filter(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1))),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.Discontinuities.Saturation saturation2(upLimit=1,lowLimit=-1,zeroCross=true) 
      annotation (Placement(transformation(origin={234,-144.731},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(dynamicSaturation(upperLimit(Type(ref="double"),Dimension=1),u(Type(ref="double"),Dimension=1),lowerLimit(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),constant_up(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),constant_low(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),upLimit(Type(ref="double"),Dimension=1),lowLimit(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0,zeroCross=true)));
    SysplorerEmbeddedCoder.Port.Inport wb_act 
      annotation (Placement(transformation(origin={304,-224},
extent={{-10,-10},{10,10}},
rotation=180),
iconTransformation(origin={-301.8,-48},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=[3])));
    SysplorerEmbeddedCoder.Port.Inport Euler_act 
      annotation (Placement(transformation(origin={304,-280},
extent={{-10,-10},{10,10}},
rotation=180),
iconTransformation(origin={-301.8,-96},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=[3])));
    SysplorerEmbeddedCoder.SignalRouting.DeMux deMux(portNumber=3) 
      annotation (Placement(transformation(origin={214,-224},
extent={{-3,-27.5},{3,27.4999976}},
rotation=180)),__MWORKS(BlockSystem(Instance(y(y1(Type(ref="double"),Dimension=1),y2(Type(ref="double"),Dimension=1),y3(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=[3])),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.SignalRouting.DeMux deMux1(portNumber=3) 
      annotation (Placement(transformation(origin={244,-280},
extent={{-3,-27.5},{3,27.4999976}},
rotation=180)),__MWORKS(BlockSystem(Instance(y(y1(Type(ref="double"),Dimension=1),y2(Type(ref="double"),Dimension=1),y3(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=[3])),SampleTime(group="D0")=0)));

    annotation (defaultComponentName="subSystem", __MWORKS(PortArrangement(Left(roll_deg_d, pitch_deg_d, yaw_deg_d, wb_act, Euler_act), Right(roll_pwm, pitch_pwm, yaw_pwm)),BlockSystem(blockKind=BlockKind.subSystem, SampleTime(auto=true), SubSystem(virtual=true, functionPack=FunctionPack.auto, functionName="", sourceFile="")),PortLabels(labelType="PortName"),sourceModel=SysplorerEmbeddedCoder.SubSystems.SubSystem,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-300,-120},{300,120}},
  grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
  rotationPolicy=RotationPolicy.Follow,
  origin={0,0},
  fillColor={255,255,255},
  fillPattern=FillPattern.Solid,
  lineThickness=3,
  extent={{-300,120},{300,-120}}), Text(origin={0,-140},
  lineColor={0,0,0},
  extent={{0,-20},{0,20}},
  textString="%name",
  fontSize=14,
  textStyle={TextStyle.None},
  textColor={0,0,0},
  verticalAlignment=TextAlignment.Top)},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
grid={2,2})));
  equation
    connect(roll_deg_d, gain.u) 
    annotation(Line(origin={-90,-1},
    points={{-9.99997,0.154223},{10.2,0.154223}},
    color={0,0,0}));
    connect(gain.y, sum1.u1) 
    annotation(Line(origin={-44,-1},
    points={{-12.2,0.154223},{12.2,0.154223}},
    color={0,0,0}));
    connect(sum1.y, roll_kp.u) 
    annotation(Line(origin={4,-6},
    points={{-12.2,0.154223},{12.2,0.154223}},
    color={0,0,0}));
    connect(roll_kp.y, sum2.u1) 
    annotation(Line(origin={52,-6},
    points={{-12.2,0.154223},{12.2,0.154223}},
    color={0,0,0}));
    connect(sum2.y, pIDController.u1) 
    annotation(Line(origin={104,-11},
points={{-16.2,0.154223},{8.2,0.154223}},
color={0,0,0}));
    connect(pIDController.outport, saturation.u) 
    annotation(Line(origin={152,-11},
points={{-8.2,0.154223},{8.2,0.154223}},
color={0,0,0}));
    connect(roll_pwm, saturation.y) 
    annotation(Line(origin={200,-11},
    points={{16,0.154223},{-16.2,0.154223}},
    color={0,0,0}));
    connect(pitch_deg_d, gain1.u) 
    annotation(Line(origin={-58,-67.9428},
points={{-9.99997,0.154223},{10.2,0.154223}},
color={0,0,0}));
    connect(gain1.y, sum3.u1) 
    annotation(Line(origin={-12,-67.9428},
points={{-12.2,0.154223},{12.2,0.154223}},
color={0,0,0}));
    connect(sum3.y, pitch_kp.u) 
    annotation(Line(origin={36,-72.9428},
points={{-12.2,0.154223},{12.2,0.154223}},
color={0,0,0}));
    connect(pitch_kp.y, sum4.u1) 
    annotation(Line(origin={84,-72.9428},
points={{-12.2,0.154223},{12.2,0.154223}},
color={0,0,0}));
    connect(sum4.y, pIDController1.u1) 
    annotation(Line(origin={136,-77.9428},
points={{-16.2,0.154223},{8.2,0.1542}},
color={0,0,0}));
    connect(pIDController1.outport, saturation1.u) 
    annotation(Line(origin={184,-77.9428},
points={{-8.2,0.1542},{8.2,0.1542}},
color={0,0,0}));
    connect(pitch_pwm, saturation1.y) 
    annotation(Line(origin={232,-77.9428},
points={{16,0.154205},{-16.2,0.1542}},
color={0,0,0}));
    connect(yaw_deg_d, gain2.u) 
    annotation(Line(origin={-28,-134.886},
points={{-9.99997,0.154223},{10.2,0.154223}},
color={0,0,0}));
    connect(gain2.y, sum5.u1) 
    annotation(Line(origin={18,-134.886},
points={{-12.2,0.154223},{12.2,0.154223}},
color={0,0,0}));
    connect(sum5.y, yaw_kp.u) 
    annotation(Line(origin={66,-139.886},
points={{-12.2,0.154223},{12.2,0.154223}},
color={0,0,0}));
    connect(yaw_kp.y, sum6.u1) 
    annotation(Line(origin={114,-139.886},
points={{-12.2,0.154223},{12.2,0.154223}},
color={0,0,0}));
    connect(sum6.y, pIDController2.u1) 
    annotation(Line(origin={166,-144.886},
points={{-16.2,0.154223},{8.2,0.1542}},
color={0,0,0}));
    connect(pIDController2.outport, saturation2.u) 
    annotation(Line(origin={214,-144.886},
points={{-8.2,0.1542},{8.2,0.1542}},
color={0,0,0}));
    connect(yaw_pwm, saturation2.y) 
    annotation(Line(origin={262,-144.886},
points={{16,0.154205},{-16.2,0.1542}},
color={0,0,0}));
    connect(wb_act, deMux.u) 
    annotation(Line(origin={255,-224},
    points={{37,-4.8e-6},{-36.2,-4.8e-6}},
    color={0,0,0}));
    connect(Euler_act, deMux1.u) 
    annotation(Line(origin={270,-280},
    points={{22,-4.8e-6},{-21.2,-4.8e-6}},
    color={0,0,0}));
    connect(deMux1.y2, sum3.u2) 
    annotation(Line(origin={118,-179},
    points={{121.2,-101},{-108.4,-101},{-108.4,86.2115},{-121.6,86.2115},{-121.6,101.2115},{-117.8,101.2115}},
    color={0,0,0}));
    connect(deMux.y1, sum2.u2) 
    annotation(Line(origin={135,-129},
    points={{74.2,-113.333},{-59.4,-113.333},{-59.4,98.154223},{-74.6,98.154223},{-74.6,113.154223},{-70.8,113.154223}},
    color={0,0,0}));
    connect(deMux.y2, sum4.u2) 
    annotation(Line(origin={151,-153},
    points={{58.2,-71},{-45.4,-71},{-45.4,55.2115},{-58.6,55.2115},{-58.6,70.2115},{-54.8,70.2115}},
    color={0,0,0}));
    connect(deMux.y3, sum6.u2) 
    annotation(Line(origin={166,-178},
    points={{43.2,-27.6667},{-43.6,-27.6667},{-43.6,28.269},{-39.8,28.269}},
    color={0,0,0}));
    connect(deMux1.y1, sum1.u2) 
    annotation(Line(origin={102,-155},
    points={{137.2,-143.333},{-122.4,-143.333},{-122.4,129.154223},{-137.6,129.154223},{-137.6,144.154223},{-133.8,144.154223}},
    color={0,0,0}));
    connect(deMux1.y3, sum5.u2) 
    annotation(Line(origin={133,-203},
points={{106.2,-58.6667},{-106.6,-58.6667},{-106.6,58.269},{-102.8,58.269}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
    end SubSystem1;
  block JuliaFunction "编辑和调用Julia脚本函数"
      annotation (defaultComponentName = "juliaFunction", __MWORKS(BlockSystem(blockKind=BlockKind.subSystem,bltBlockKind=BltBlockKind.juliaFunctionSystem,Subsystem(virtual=true,functionPack=FunctionPack.auto,functionName="",sourceFile=""),SampleTime(auto = true),SubSystem),PortArrangement(Left(in_thrust,in_roll_pwm,in_pitch_pwm,in_yaw_pwm),Right(out_m1,out_m2,out_m3,out_m4)),sourceModel=SysplorerEmbeddedCoder.Utilities.JuliaFunction,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-200,-100},{200,100}},
  grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
  rotationPolicy=RotationPolicy.Follow,
  origin={0,0},
  fillColor={255,255,255},
  fillPattern=FillPattern.Solid,
  lineThickness=3,
  extent={{-200,100},{200,-100}}), Text(origin={0,-75},
  lineColor={0,0,0},
  extent={{-200,20},{200,-20}},
  textString="%juliaFunctionName",
  fontSize=14,
  textStyle={TextStyle.None},
  textColor={0,0,0}), Text(origin={0,-120},
  lineColor={0,0,0},
  extent={{0,-20},{0,20}},
  textString="%name",
  fontSize=14,
  textStyle={TextStyle.None},
  textColor={0,0,0},
  verticalAlignment=TextAlignment.Top), Bitmap(origin={0,0},
  extent={{-40,-40},{40,40}},
  fileName="modelica://SysplorerEmbeddedCoder/Resources/Icons/JuliaFunction.svg")},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
  grid={2,2})),Protection(access=Access.packageDuplicate));

      block JuliaFunctionAtomic
          annotation (__MWORKS(BlockSystem(blockKind=Types.BlockKind.atomic,
              bltBlockKind=Types.BltBlockKind.juliaFunction), hide=true),Protection(access=Access.packageDuplicate));
        SysplorerEmbeddedCoder.Types.InputAuto in_thrust annotation(Placement(transformation(origin={ -240,90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
        SysplorerEmbeddedCoder.Types.InputAuto in_roll_pwm annotation(Placement(transformation(origin={ -240,30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
        SysplorerEmbeddedCoder.Types.InputAuto in_pitch_pwm annotation(Placement(transformation(origin={ -240,-30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
        SysplorerEmbeddedCoder.Types.InputAuto in_yaw_pwm annotation(Placement(transformation(origin={ -240,-90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
        SysplorerEmbeddedCoder.Types.OutputAuto out_m1 annotation(Placement(transformation(origin={ -240,90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
        SysplorerEmbeddedCoder.Types.OutputAuto out_m2 annotation(Placement(transformation(origin={ -240,30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
        SysplorerEmbeddedCoder.Types.OutputAuto out_m3 annotation(Placement(transformation(origin={ -240,-30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
        SysplorerEmbeddedCoder.Types.OutputAuto out_m4 annotation(Placement(transformation(origin={ -240,-90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
        parameter String juliaScript = "function motor_mixer(thrust,roll_pwm,pitch_pwm,yaw_pwm)\r\n    #输入的是都是占空比（0-1）之间\r\n    #输出四个电机的指令值，1000-2000\r\n    #这里采用x型机架，x型机架的分配和十字型的不一样\r\n    \r\n    K = 1000;#将输入定在0-1000\r\n    pwm_base = 1000;#PWM从1000开始\r\n    \r\n    m1 = (thrust - roll_pwm + pitch_pwm + yaw_pwm) * K + pwm_base;\r\n    m2 = (thrust + roll_pwm - pitch_pwm + yaw_pwm) * K + pwm_base;\r\n    m3 = (thrust + roll_pwm + pitch_pwm - yaw_pwm) * K + pwm_base;\r\n    m4 = (thrust - roll_pwm - pitch_pwm - yaw_pwm) * K + pwm_base;\r\n    return m1,m2,m3,m4;\r\n    end" annotation (HideResult = true);
        parameter String juliaObjectName = "motor_mixer" annotation (HideResult = true);
        end JuliaFunctionAtomic;

      JuliaFunctionAtomic juliaFunctionAtomic annotation(HideResult = true,__MWORKS(BlockSystem(Instance(in_thrust(Type(ref="double")),in_roll_pwm(Type(ref="double"),Dimension=1),in_pitch_pwm(Type(ref="double"),Dimension=1),in_yaw_pwm(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.Types.InputAuto in_thrust annotation(Placement(transformation(origin={ -240,90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
    SysplorerEmbeddedCoder.Types.InputAuto in_roll_pwm annotation(Placement(transformation(origin={ -240,30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
    SysplorerEmbeddedCoder.Types.InputAuto in_pitch_pwm annotation(Placement(transformation(origin={ -240,-30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
    SysplorerEmbeddedCoder.Types.InputAuto in_yaw_pwm annotation(Placement(transformation(origin={ -240,-90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
    SysplorerEmbeddedCoder.Types.OutputAuto out_m1 annotation(Placement(transformation(origin={ -240,90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
    SysplorerEmbeddedCoder.Types.OutputAuto out_m2 annotation(Placement(transformation(origin={ -240,30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
    SysplorerEmbeddedCoder.Types.OutputAuto out_m3 annotation(Placement(transformation(origin={ -240,-30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
    SysplorerEmbeddedCoder.Types.OutputAuto out_m4 annotation(Placement(transformation(origin={ -240,-90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
    parameter String juliaFunctionName = "motor_mixer" annotation(HideResult = true);
    equation
    connect(in_thrust, juliaFunctionAtomic.in_thrust);
    connect(in_roll_pwm, juliaFunctionAtomic.in_roll_pwm);
    connect(in_pitch_pwm, juliaFunctionAtomic.in_pitch_pwm);
    connect(in_yaw_pwm, juliaFunctionAtomic.in_yaw_pwm);
    connect(out_m1, juliaFunctionAtomic.out_m1);
    connect(out_m2, juliaFunctionAtomic.out_m2);
    connect(out_m3, juliaFunctionAtomic.out_m3);
    connect(out_m4, juliaFunctionAtomic.out_m4);
    end JuliaFunction;
  block SubSystem2 "选择子系统模块的设置。 要启用涉及代码生成的相关参数, 请选择 '视为原子单元' 。"

    SysplorerEmbeddedCoder.Port.Inport pwm 
      annotation (Placement(transformation(origin={-122,-0.845782},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,0},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=[4])));
    SysplorerEmbeddedCoder.Discontinuities.Saturation saturation(upLimit=2000,lowLimit=1000,zeroCross=true) 
      annotation (Placement(transformation(origin={-82,-0.845777},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(dynamicSaturation(upperLimit(Type(ref="double"),Dimension=1),u(Type(ref="double"),Dimension=[4]),lowerLimit(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=[4])),u(Type(ref="double"),Dimension=[4]),y(Type(ref="double"),Dimension=[4]),constant_up(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),constant_low(y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),upLimit(Type(ref="double"),Dimension=1),lowLimit(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0,zeroCross=true)));
    SysplorerEmbeddedCoder.SignalRouting.DeMux deMux(portNumber=4) 
      annotation (Placement(transformation(origin={-44,-0.845777},
extent={{-2,-24},{2,24}})),__MWORKS(BlockSystem(Instance(y(y1(Type(ref="double"),Dimension=1),y2(Type(ref="double"),Dimension=1),y3(Type(ref="double"),Dimension=1),y4(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=[4])),SampleTime(group="D0")=0)));
    SubSystem subSystem 
      annotation (Placement(transformation(origin={44,-0.845777},
extent={{-30,-24},{30,24}})),__MWORKS(PortLabels(labelType="PortName")));
    SysplorerEmbeddedCoder.SignalRouting.DeMux deMux1(portNumber=4) 
      annotation (Placement(transformation(origin={144,-0.5},
extent={{-2,-43},{2,43}})),__MWORKS(BlockSystem(Instance(y(y1(Type(ref="double"),Dimension=1),y2(Type(ref="double"),Dimension=1),y3(Type(ref="double"),Dimension=1),y4(Type(ref="double"),Dimension=1)),u(Type(ref="double"),Dimension=[4])),SampleTime(group="D0")=0)));
    SubSystem1 subSystem1 
      annotation (Placement(transformation(origin={208,-0.5},
extent={{-30,-43},{30,43}})),__MWORKS(PortLabels(labelType="PortName")));
    SubSystem2 subSystem2 
      annotation (Placement(transformation(origin={424,48},
extent={{-30,-29.5},{30,29.5}})),__MWORKS(PortLabels(labelType="PortName")));
    SubSystem3 subSystem3 
      annotation (Placement(transformation(origin={528,48},
extent={{-22,-29.5},{22,29.5}})),__MWORKS(PortLabels(labelType="PortName")));
    Scope x_pos 
      annotation (Placement(transformation(origin={644,116.5},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.SignalRouting.Mux mux(portNumber=3) 
      annotation (Placement(transformation(origin={686,59.8},
extent={{-2,-27},{2,27}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=[3])),SampleTime(group="D0")=0)));
    Scope1 y_pos 
      annotation (Placement(transformation(origin={722,102},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.Port.Outport POS 
      annotation (Placement(transformation(origin={730,59.8},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,100},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=[3])));
    SysplorerEmbeddedCoder.Port.Outport vec 
      annotation (Placement(transformation(origin={716,8.5},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,60},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=[3])));
    Scope2 z_pos 
      annotation (Placement(transformation(origin={610,14.5},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
    SubSystem4 subSystem4 
      annotation (Placement(transformation(origin={327,-93.625},
extent={{-17,-50.125},{17,50.125}})),__MWORKS(PortLabels(labelType="PortName")));
    SubSystem5 subSystem5 
      annotation (Placement(transformation(origin={464,-114.3333},
extent={{-20,-50.125},{20,50.125}})),__MWORKS(PortLabels(labelType="PortName")));
    SysplorerEmbeddedCoder.Port.Outport wb_vec 
      annotation (Placement(transformation(origin={384,-154.4583},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,20},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=[3])));
    SysplorerEmbeddedCoder.Port.Outport w_yaw 
      annotation (Placement(transformation(origin={540,-151.9271},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-20},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.SignalRouting.Mux mux1(portNumber=3) 
      annotation (Placement(transformation(origin={628,-76.7396},
extent={{-2,-28},{2,28}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=[3])),SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.Port.Outport Euler 
      annotation (Placement(transformation(origin={706,-76.7396},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-60},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=[3])));
    SysplorerEmbeddedCoder.Port.Outport pos_state 
      annotation (Placement(transformation(origin={790,-37},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-100},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=[3])));
    SysplorerEmbeddedCoder.SignalRouting.Mux mux2(portNumber=3) 
      annotation (Placement(transformation(origin={744,-37},
extent={{-3,-39},{3,39}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=[3])),SampleTime(group="D0")=0)));

    annotation (defaultComponentName="subSystem", __MWORKS(PortArrangement(Left(pwm), Right(POS, vec, wb_vec, w_yaw, Euler, pos_state)),BlockSystem(blockKind=BlockKind.subSystem, SampleTime(auto=true), SubSystem(virtual=true, functionPack=FunctionPack.auto, functionName="", sourceFile="")),PortLabels(labelType="PortName"),sourceModel=SysplorerEmbeddedCoder.SubSystems.SubSystem,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-300,-120},{300,120}},
  grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
  rotationPolicy=RotationPolicy.Follow,
  origin={0,0},
  fillColor={255,255,255},
  fillPattern=FillPattern.Solid,
  lineThickness=3,
  extent={{-300,120},{300,-120}}), Text(origin={0,-140},
  lineColor={0,0,0},
  extent={{0,-20},{0,20}},
  textString="%name",
  fontSize=14,
  textStyle={TextStyle.None},
  textColor={0,0,0},
  verticalAlignment=TextAlignment.Top)},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
grid={2,2}),graphics = {Text(origin={44,-32},
lineColor={0,0,0},
extent={{-20,-10},{20,10}},
textString="动力单元模型",
fontSize=14,
textStyle={TextStyle.None},
textColor={0,0,0}), Text(origin={614.893,15.0437},
lineColor={0,0,0},
extent={{-20,-10},{20,10}},
textString="`",
fontSize=14,
textStyle={TextStyle.None},
textColor={0,0,0},
horizontalAlignment=TextAlignment.Left), Text(origin={208,-53.5},
lineColor={0,0,0},
extent={{-20,-10},{20,10}},
textString="控制效率模型",
fontSize=14,
textStyle={TextStyle.None},
textColor={0,0,0}), Text(origin={324,-154.458},
lineColor={0,0,0},
extent={{-20,-10},{20,10}},
textString="姿态动力学",
fontSize=14,
textStyle={TextStyle.None},
textColor={0,0,0}), Text(origin={424,10.5},
lineColor={0,0,0},
extent={{-20,-10},{20,10}},
textString="位置动力学",
fontSize=14,
textStyle={TextStyle.None},
textColor={0,0,0}), Text(origin={526,10.5},
lineColor={0,0,0},
extent={{-20,-10},{20,10}},
textString="位置运动学",
fontSize=14,
textStyle={TextStyle.None},
textColor={0,0,0}), Text(origin={464,-169.5},
lineColor={0,0,0},
extent={{-20,-10},{20,10}},
textString="姿态运动学",
fontSize=14,
textStyle={TextStyle.None},
textColor={0,0,0})}));
    block SubSystem "选择子系统模块的设置。 要启用涉及代码生成的相关参数, 请选择 '视为原子单元' 。"

      SysplorerEmbeddedCoder.Port.Inport u 
        annotation (Placement(transformation(origin={-55.8426,-0.845782},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,90},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Outport y 
        annotation (Placement(transformation(origin={342,-99},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,0},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=[4])));
      SysplorerEmbeddedCoder.MathOperation.Sum sum1(isSaturate=false,inputs="+-") 
        annotation (Placement(transformation(origin={20,-5.84578},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0,Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap)),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
      SysplorerEmbeddedCoder.Sources.Constant constant1(k=1000) 
        annotation (Placement(transformation(origin={-102,-20},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));
      SysplorerEmbeddedCoder.MathOperation.Gain gain(k=1/1000) 
        annotation (Placement(transformation(origin={66,-5.84578},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
      SubSystem subSystem 
        annotation (Placement(transformation(origin={132,-5.84578},
extent={{-30,-12},{30,12}})),__MWORKS(PortLabels(labelType="PortName")));
      SysplorerEmbeddedCoder.Continuous.StateSpace stateSpace(B=1,A=-1/PowerUnit_Tm,C=1/PowerUnit_Tm,D=0,x0=557.142*PowerUnit_Tm) 
        annotation (Placement(transformation(origin={210,-5.84578},
extent={{-15,-10},{15,10}})),__MWORKS(BlockSystem(Instance(absoluteTolerance(Type(ref="double"),Dimension=1),u(Dimension=1),y(Dimension=1),A(Dimension=1),B(Dimension=1),C(Dimension=1),D(Dimension=1),x0(Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.SignalRouting.Mux mux(portNumber=4) 
        annotation (Placement(transformation(origin={282,-99},
extent={{-2,-33},{2,33}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1),u4(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=[4])),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Port.Inport u1 
        annotation (Placement(transformation(origin={-55.8426,-53.000002},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,30},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.MathOperation.Sum sum2(isSaturate=false,inputs="+-") 
        annotation (Placement(transformation(origin={20,-58},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0,Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap)),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
      SysplorerEmbeddedCoder.Sources.Constant constant2(k=1000) 
        annotation (Placement(transformation(origin={-102,-72.1542},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));
      SysplorerEmbeddedCoder.MathOperation.Gain gain1(k=1/1000) 
        annotation (Placement(transformation(origin={66,-58},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
      SubSystem1 subSystem1 
        annotation (Placement(transformation(origin={132,-58},
extent={{-30,-12},{30,12}})),__MWORKS(PortLabels(labelType="PortName")));
      SysplorerEmbeddedCoder.Continuous.StateSpace stateSpace1(B=1,A=-1/PowerUnit_Tm,C=1/PowerUnit_Tm,D=0,x0=557.142*PowerUnit_Tm) 
        annotation (Placement(transformation(origin={210,-58},
extent={{-15,-10},{15,10}})),__MWORKS(BlockSystem(Instance(absoluteTolerance(Type(ref="double"),Dimension=1),u(Dimension=1),y(Dimension=1),A(Dimension=1),B(Dimension=1),C(Dimension=1),D(Dimension=1),x0(Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Port.Inport u2 
        annotation (Placement(transformation(origin={-59.8426,-111},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,-30},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.MathOperation.Sum sum3(isSaturate=false,inputs="+-") 
        annotation (Placement(transformation(origin={16,-116},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0,Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap)),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
      SysplorerEmbeddedCoder.Sources.Constant constant3(k=1000) 
        annotation (Placement(transformation(origin={-106,-130.1542},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));
      SysplorerEmbeddedCoder.MathOperation.Gain gain2(k=1/1000) 
        annotation (Placement(transformation(origin={62,-116},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
      SubSystem2 subSystem2 
        annotation (Placement(transformation(origin={128,-116},
extent={{-30,-12},{30,12}})),__MWORKS(PortLabels(labelType="PortName")));
      SysplorerEmbeddedCoder.Continuous.StateSpace stateSpace2(B=1,A=-1/PowerUnit_Tm,C=1/PowerUnit_Tm,D=0,x0=557.142*PowerUnit_Tm) 
        annotation (Placement(transformation(origin={206,-116},
extent={{-15,-10},{15,10}})),__MWORKS(BlockSystem(Instance(absoluteTolerance(Type(ref="double"),Dimension=1),u(Dimension=1),y(Dimension=1),A(Dimension=1),B(Dimension=1),C(Dimension=1),D(Dimension=1),x0(Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Port.Inport u3 
        annotation (Placement(transformation(origin={-59.8426,-169},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,-90},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.MathOperation.Sum sum4(isSaturate=false,inputs="+-") 
        annotation (Placement(transformation(origin={16,-174},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0,Type(overflowKind=SysplorerEmbeddedCoder.Types.OverflowKind.wrap)),PortLabels(labelType="CustomType",labels(label(text="+",instance="u1"),label(text="-",instance="u2")))));
      SysplorerEmbeddedCoder.Sources.Constant constant4(k=1000) 
        annotation (Placement(transformation(origin={-106,-188.1542},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));
      SysplorerEmbeddedCoder.MathOperation.Gain gain3(k=1/1000) 
        annotation (Placement(transformation(origin={62,-174},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
      SubSystem3 subSystem3 
        annotation (Placement(transformation(origin={128,-174},
extent={{-30,-12},{30,12}})),__MWORKS(PortLabels(labelType="PortName")));
      SysplorerEmbeddedCoder.Continuous.StateSpace stateSpace3(B=1,A=-1/PowerUnit_Tm,C=1/PowerUnit_Tm,D=0,x0=557.142*PowerUnit_Tm) 
        annotation (Placement(transformation(origin={206,-174},
extent={{-15,-10},{15,10}})),__MWORKS(BlockSystem(Instance(absoluteTolerance(Type(ref="double"),Dimension=1),u(Dimension=1),y(Dimension=1),A(Dimension=1),B(Dimension=1),C(Dimension=1),D(Dimension=1),x0(Dimension=1)),SampleTime(group="D0")=0)));
      annotation (defaultComponentName="subSystem", __MWORKS(PortArrangement(Left(u, u1, u2, u3), Right(y)),BlockSystem(blockKind=BlockKind.subSystem, SampleTime(auto=true), SubSystem(virtual=true, functionPack=FunctionPack.auto, functionName="", sourceFile="")),PortLabels(labelType="PortName"),sourceModel=SysplorerEmbeddedCoder.SubSystems.SubSystem,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-300,-120},{300,120}},
    grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
    rotationPolicy=RotationPolicy.Follow,
    origin={0,0},
    fillColor={255,255,255},
    fillPattern=FillPattern.Solid,
    lineThickness=3,
    extent={{-300,120},{300,-120}}), Text(origin={0,-140},
    lineColor={0,0,0},
    extent={{0,-20},{0,20}},
    textString="%name",
    fontSize=14,
    textStyle={TextStyle.None},
    textColor={0,0,0},
    verticalAlignment=TextAlignment.Top)},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
grid={2,2})));
      block SubSystem "选择子系统模块的设置。 要启用涉及代码生成的相关参数, 请选择 '视为原子单元' 。"

        SysplorerEmbeddedCoder.Port.Inport throttle_cmd 
          annotation (Placement(transformation(origin={-55.8426,-0.845782},
      extent={{-10,-10},{10,10}}),
      iconTransformation(origin={-301.8,0},
      extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
        SysplorerEmbeddedCoder.Port.Outport Wss 
          annotation (Placement(transformation(origin={216,-5.84578},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,0},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
        SysplorerEmbeddedCoder.MathOperation.Gain Gain(k=PowerUnit_CR) 
          annotation (Placement(transformation(origin={23,-0.845777},
extent={{-29,-10},{29,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref="int32"),Dimension=1)),SampleTime(group="D0")=0)));
        SysplorerEmbeddedCoder.MathOperation.Sum sum1 
          annotation (Placement(transformation(origin={114,-5.84578},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
        SysplorerEmbeddedCoder.Sources.Constant Constant(k=PowerUnit_wb) 
          annotation (Placement(transformation(origin={-2,-68},
extent={{-41,-10},{41,10}})),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));

        annotation (defaultComponentName="subSystem", __MWORKS(PortArrangement(Left(throttle_cmd), Right(Wss)),BlockSystem(blockKind=BlockKind.subSystem, SampleTime(auto=true), SubSystem(virtual=true, functionPack=FunctionPack.auto, functionName="", sourceFile="")),PortLabels(labelType="PortName"),sourceModel=SysplorerEmbeddedCoder.SubSystems.SubSystem,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-300,-120},{300,120}},
      grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
      rotationPolicy=RotationPolicy.Follow,
      origin={0,0},
      fillColor={255,255,255},
      fillPattern=FillPattern.Solid,
      lineThickness=3,
      extent={{-300,120},{300,-120}}), Text(origin={0,-140},
      lineColor={0,0,0},
      extent={{0,-20},{0,20}},
      textString="%name",
      fontSize=14,
      textStyle={TextStyle.None},
      textColor={0,0,0},
      verticalAlignment=TextAlignment.Top)},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
grid={2,2}),graphics = {Text(origin={176,-5.84578},
lineColor={0,0,0},
extent={{-20,-10},{20,10}},
textString="wss
",
fontSize=14,
textStyle={TextStyle.None},
textColor={0,0,0},
horizontalAlignment=TextAlignment.Left)}));
      equation
        connect(throttle_cmd, Gain.u) 
        annotation(Line(origin={-26,-1},
        points={{-17.8426,0.154223},{18.2,0.154223}},
        color={0,0,0}));
        connect(Gain.y, sum1.u1) 
        annotation(Line(origin={78,-1},
        points={{-24.2,0.154223},{24.2,0.154223}},
        color={0,0,0}));
        connect(sum1.y, Wss) 
        annotation(Line(origin={164,-3},
points={{-38.2,-2.84578},{40,-2.84578}},
color={0,0,0}));
        connect(Constant.y, sum1.u2) 
        annotation(Line(origin={72,-39},
        points={{-31.2,-29},{26.4,-29},{26.4,28.15422},{30.2,28.15422}},
        color={0,0,0}));
        end SubSystem;
      block SubSystem1 "选择子系统模块的设置。 要启用涉及代码生成的相关参数, 请选择 '视为原子单元' 。"

        SysplorerEmbeddedCoder.Port.Inport throttle_cmd 
          annotation (Placement(transformation(origin={-55.8426,-0.845782},
      extent={{-10,-10},{10,10}}),
      iconTransformation(origin={-301.8,0},
      extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
        SysplorerEmbeddedCoder.Port.Outport Wss 
          annotation (Placement(transformation(origin={216,-5.84578},
      extent={{-10,-10},{10,10}}),
      iconTransformation(origin={301.8,0},
      extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
        SysplorerEmbeddedCoder.MathOperation.Gain Gain(k=PowerUnit_CR) 
          annotation (Placement(transformation(origin={23,-0.845777},
      extent={{-29,-10},{29,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref="int32"),Dimension=1)),SampleTime(group="D0")=0)));
        SysplorerEmbeddedCoder.MathOperation.Sum sum1 
          annotation (Placement(transformation(origin={114,-5.84578},
      extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
        SysplorerEmbeddedCoder.Sources.Constant Constant(k=PowerUnit_wb) 
          annotation (Placement(transformation(origin={-2,-68},
      extent={{-41,-10},{41,10}})),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));

        annotation (defaultComponentName="subSystem", __MWORKS(PortArrangement(Left(throttle_cmd), Right(Wss)),BlockSystem(blockKind=BlockKind.subSystem, SampleTime(auto=true), SubSystem(virtual=true, functionPack=FunctionPack.auto, functionName="", sourceFile="")),PortLabels(labelType="PortName"),sourceModel=SysplorerEmbeddedCoder.SubSystems.SubSystem,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-300,-120},{300,120}},
      grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
      rotationPolicy=RotationPolicy.Follow,
      origin={0,0},
      fillColor={255,255,255},
      fillPattern=FillPattern.Solid,
      lineThickness=3,
      extent={{-300,120},{300,-120}}), Text(origin={0,-140},
      lineColor={0,0,0},
      extent={{0,-20},{0,20}},
      textString="%name",
      fontSize=14,
      textStyle={TextStyle.None},
      textColor={0,0,0},
      verticalAlignment=TextAlignment.Top)},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
      grid={2,2}),graphics = {Text(origin={176,-5.84578},
      lineColor={0,0,0},
      extent={{-20,-10},{20,10}},
      textString="wss
"      ,
      fontSize=14,
      textStyle={TextStyle.None},
      textColor={0,0,0},
      horizontalAlignment=TextAlignment.Left)}));
      equation
        connect(throttle_cmd, Gain.u) 
        annotation(Line(origin={-26,-1},
        points={{-17.8426,0.154223},{18.2,0.154223}},
        color={0,0,0}));
        connect(Gain.y, sum1.u1) 
        annotation(Line(origin={78,-1},
        points={{-24.2,0.154223},{24.2,0.154223}},
        color={0,0,0}));
        connect(sum1.y, Wss) 
        annotation(Line(origin={164,-3},
      points={{-38.2,-2.84578},{40,-2.84578}},
      color={0,0,0}));
        connect(Constant.y, sum1.u2) 
        annotation(Line(origin={72,-39},
        points={{-31.2,-29},{26.4,-29},{26.4,28.15422},{30.2,28.15422}},
        color={0,0,0}));
        end SubSystem1;
      block SubSystem2 "选择子系统模块的设置。 要启用涉及代码生成的相关参数, 请选择 '视为原子单元' 。"

        SysplorerEmbeddedCoder.Port.Inport throttle_cmd 
          annotation (Placement(transformation(origin={-55.8426,-0.845782},
      extent={{-10,-10},{10,10}}),
      iconTransformation(origin={-301.8,0},
      extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
        SysplorerEmbeddedCoder.Port.Outport Wss 
          annotation (Placement(transformation(origin={216,-5.84578},
      extent={{-10,-10},{10,10}}),
      iconTransformation(origin={301.8,0},
      extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
        SysplorerEmbeddedCoder.MathOperation.Gain Gain(k=PowerUnit_CR) 
          annotation (Placement(transformation(origin={23,-0.845777},
      extent={{-29,-10},{29,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref="int32"),Dimension=1)),SampleTime(group="D0")=0)));
        SysplorerEmbeddedCoder.MathOperation.Sum sum1 
          annotation (Placement(transformation(origin={114,-5.84578},
      extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
        SysplorerEmbeddedCoder.Sources.Constant Constant(k=PowerUnit_wb) 
          annotation (Placement(transformation(origin={-2,-68},
      extent={{-41,-10},{41,10}})),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));

        annotation (defaultComponentName="subSystem", __MWORKS(PortArrangement(Left(throttle_cmd), Right(Wss)),BlockSystem(blockKind=BlockKind.subSystem, SampleTime(auto=true), SubSystem(virtual=true, functionPack=FunctionPack.auto, functionName="", sourceFile="")),PortLabels(labelType="PortName"),sourceModel=SysplorerEmbeddedCoder.SubSystems.SubSystem,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-300,-120},{300,120}},
      grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
      rotationPolicy=RotationPolicy.Follow,
      origin={0,0},
      fillColor={255,255,255},
      fillPattern=FillPattern.Solid,
      lineThickness=3,
      extent={{-300,120},{300,-120}}), Text(origin={0,-140},
      lineColor={0,0,0},
      extent={{0,-20},{0,20}},
      textString="%name",
      fontSize=14,
      textStyle={TextStyle.None},
      textColor={0,0,0},
      verticalAlignment=TextAlignment.Top)},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
      grid={2,2}),graphics = {Text(origin={176,-5.84578},
      lineColor={0,0,0},
      extent={{-20,-10},{20,10}},
      textString="wss
"            ,
      fontSize=14,
      textStyle={TextStyle.None},
      textColor={0,0,0},
      horizontalAlignment=TextAlignment.Left)}));
      equation
        connect(throttle_cmd, Gain.u) 
        annotation(Line(origin={-26,-1},
        points={{-17.8426,0.154223},{18.2,0.154223}},
        color={0,0,0}));
        connect(Gain.y, sum1.u1) 
        annotation(Line(origin={78,-1},
        points={{-24.2,0.154223},{24.2,0.154223}},
        color={0,0,0}));
        connect(sum1.y, Wss) 
        annotation(Line(origin={164,-3},
      points={{-38.2,-2.84578},{40,-2.84578}},
      color={0,0,0}));
        connect(Constant.y, sum1.u2) 
        annotation(Line(origin={72,-39},
        points={{-31.2,-29},{26.4,-29},{26.4,28.15422},{30.2,28.15422}},
        color={0,0,0}));
        end SubSystem2;
      block SubSystem3 "选择子系统模块的设置。 要启用涉及代码生成的相关参数, 请选择 '视为原子单元' 。"

        SysplorerEmbeddedCoder.Port.Inport throttle_cmd 
          annotation (Placement(transformation(origin={-55.8426,-0.845782},
      extent={{-10,-10},{10,10}}),
      iconTransformation(origin={-301.8,0},
      extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
        SysplorerEmbeddedCoder.Port.Outport Wss 
          annotation (Placement(transformation(origin={216,-5.84578},
      extent={{-10,-10},{10,10}}),
      iconTransformation(origin={301.8,0},
      extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
        SysplorerEmbeddedCoder.MathOperation.Gain Gain(k=PowerUnit_CR) 
          annotation (Placement(transformation(origin={23,-0.845777},
      extent={{-29,-10},{29,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref="int32"),Dimension=1)),SampleTime(group="D0")=0)));
        SysplorerEmbeddedCoder.MathOperation.Sum sum1 
          annotation (Placement(transformation(origin={114,-5.84578},
      extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
        SysplorerEmbeddedCoder.Sources.Constant Constant(k=PowerUnit_wb) 
          annotation (Placement(transformation(origin={-2,-68},
      extent={{-41,-10},{41,10}})),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));

        annotation (defaultComponentName="subSystem", __MWORKS(PortArrangement(Left(throttle_cmd), Right(Wss)),BlockSystem(blockKind=BlockKind.subSystem, SampleTime(auto=true), SubSystem(virtual=true, functionPack=FunctionPack.auto, functionName="", sourceFile="")),PortLabels(labelType="PortName"),sourceModel=SysplorerEmbeddedCoder.SubSystems.SubSystem,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-300,-120},{300,120}},
      grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
      rotationPolicy=RotationPolicy.Follow,
      origin={0,0},
      fillColor={255,255,255},
      fillPattern=FillPattern.Solid,
      lineThickness=3,
      extent={{-300,120},{300,-120}}), Text(origin={0,-140},
      lineColor={0,0,0},
      extent={{0,-20},{0,20}},
      textString="%name",
      fontSize=14,
      textStyle={TextStyle.None},
      textColor={0,0,0},
      verticalAlignment=TextAlignment.Top)},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
      grid={2,2}),graphics = {Text(origin={176,-5.84578},
      lineColor={0,0,0},
      extent={{-20,-10},{20,10}},
      textString="wss
"            ,
      fontSize=14,
      textStyle={TextStyle.None},
      textColor={0,0,0},
      horizontalAlignment=TextAlignment.Left)}));
      equation
        connect(throttle_cmd, Gain.u) 
        annotation(Line(origin={-26,-1},
        points={{-17.8426,0.154223},{18.2,0.154223}},
        color={0,0,0}));
        connect(Gain.y, sum1.u1) 
        annotation(Line(origin={78,-1},
        points={{-24.2,0.154223},{24.2,0.154223}},
        color={0,0,0}));
        connect(sum1.y, Wss) 
        annotation(Line(origin={164,-3},
      points={{-38.2,-2.84578},{40,-2.84578}},
      color={0,0,0}));
        connect(Constant.y, sum1.u2) 
        annotation(Line(origin={72,-39},
        points={{-31.2,-29},{26.4,-29},{26.4,28.15422},{30.2,28.15422}},
        color={0,0,0}));
        end SubSystem3;
      equation
      connect(u, sum1.u1) 
      annotation(Line(origin={-18,-1},
      points={{-25.8426,0.154223},{26.2,0.154223}},
      color={0,0,0}));
      connect(constant1.y, sum1.u2) 
      annotation(Line(origin={-41,-15},
      points={{-49.2,-5},{45.4,-5},{45.4,4.15422},{49.2,4.15422}},
      color={0,0,0}));
      connect(sum1.y, gain.u) 
      annotation(Line(origin={43,-6},
      points={{-11.2,0.15422},{11.2,0.15422}},
      color={0,0,0}));
      connect(gain.y, subSystem.throttle_cmd) 
      annotation(Line(origin={89,-6},
      points={{-11.2,0.15422},{11.2,0.15422}},
      color={0,0,0}));
      connect(subSystem.Wss, stateSpace.u) 
      annotation(Line(origin={179,-6},
      points={{-15.2,0.15422},{14.2,0.15422}},
      color={0,0,0}));
      connect(u1, sum2.u1) 
      annotation(Line(origin={-18,-53.15422},
points={{-25.8426,0.154223},{26.2,0.15422}},
color={0,0,0}));
      connect(constant2.y, sum2.u2) 
      annotation(Line(origin={-41,-67.1542},
points={{-49.2,-5},{45.4,-5},{45.4,4.15422},{49.2,4.15422}},
color={0,0,0}));
      connect(sum2.y, gain1.u) 
      annotation(Line(origin={43,-58.15422},
points={{-11.2,0.15422},{11.2,0.15422}},
color={0,0,0}));
      connect(gain1.y, subSystem1.throttle_cmd) 
      annotation(Line(origin={89,-58.15422},
points={{-11.2,0.15422},{11.2,0.15422}},
color={0,0,0}));
      connect(subSystem1.Wss, stateSpace1.u) 
      annotation(Line(origin={179,-58.15422},
points={{-15.2,0.15422},{14.2,0.15422}},
color={0,0,0}));
      connect(u2, sum3.u1) 
      annotation(Line(origin={-22,-111.154},
points={{-25.8426,0.154223},{26.2,0.15422}},
color={0,0,0}));
      connect(constant3.y, sum3.u2) 
      annotation(Line(origin={-45,-125.154},
points={{-49.2,-4.99998},{45.4,-4.99998},{45.4,4.15422},{49.2,4.15422}},
color={0,0,0}));
      connect(sum3.y, gain2.u) 
      annotation(Line(origin={39,-116.154},
points={{-11.2,0.15422},{11.2,0.15422}},
color={0,0,0}));
      connect(gain2.y, subSystem2.throttle_cmd) 
      annotation(Line(origin={85,-116.154},
points={{-11.2,0.15422},{11.2,0.15422}},
color={0,0,0}));
      connect(subSystem2.Wss, stateSpace2.u) 
      annotation(Line(origin={175,-116.154},
points={{-15.2,0.15422},{14.2,0.15422}},
color={0,0,0}));
      connect(u3, sum4.u1) 
      annotation(Line(origin={-22,-169.15422},
points={{-25.8426,0.154223},{26.2,0.15422}},
color={0,0,0}));
      connect(constant4.y, sum4.u2) 
      annotation(Line(origin={-45,-183.15422},
points={{-49.2,-4.99998},{45.4,-4.99998},{45.4,4.15422},{49.2,4.15422}},
color={0,0,0}));
      connect(sum4.y, gain3.u) 
      annotation(Line(origin={39,-174.15422},
points={{-11.2,0.15422},{11.2,0.15422}},
color={0,0,0}));
      connect(gain3.y, subSystem3.throttle_cmd) 
      annotation(Line(origin={85,-174.15422},
points={{-11.2,0.15422},{11.2,0.15422}},
color={0,0,0}));
      connect(subSystem3.Wss, stateSpace3.u) 
      annotation(Line(origin={175,-174.15422},
points={{-15.2,0.15422},{14.2,0.15422}},
color={0,0,0}));
      connect(mux.y, y) 
      annotation(Line(origin={308,-99},
      points={{-22.2,0},{22,0}},
      color={0,0,0}));
      connect(stateSpace.y, mux.u1) 
      annotation(Line(origin={253,-40},
      points={{-26.2,34.15422},{21.4,34.15422},{21.4,-34.25},{25.2,-34.25}},
      color={0,0,0}));
      connect(stateSpace1.y, mux.u2) 
      annotation(Line(origin={253,-74},
points={{-26.2,16},{9,16},{9,-16.75},{25.2,-16.75}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
      connect(stateSpace2.y, mux.u3) 
      annotation(Line(origin={251,-112},
points={{-28.2,-4},{-1,-4},{-1,4.75},{27.2,4.75}},
color={0,0,0}));
      connect(stateSpace3.y, mux.u4) 
      annotation(Line(origin={251,-149},
points={{-28.2,-25},{5,-25},{5,25.25},{27.2,25.25}},
color={0,0,0}));
      end SubSystem;
    block SubSystem1 "选择子系统模块的设置。 要启用涉及代码生成的相关参数, 请选择 '视为原子单元' 。"

      annotation (defaultComponentName="subSystem", __MWORKS(PortArrangement(Left(n1, n2, n3, n4), Right(f, tao_x, tao_y, tao_z)),BlockSystem(blockKind=BlockKind.subSystem, SampleTime(auto=true), SubSystem(virtual=true, functionPack=FunctionPack.auto, functionName="", sourceFile="")),PortLabels(labelType="PortName"),sourceModel=SysplorerEmbeddedCoder.SubSystems.SubSystem,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-300,-120},{300,120}},
    grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
    rotationPolicy=RotationPolicy.Follow,
    origin={0,0},
    fillColor={255,255,255},
    fillPattern=FillPattern.Solid,
    lineThickness=3,
    extent={{-300,120},{300,-120}}), Text(origin={0,-140},
    lineColor={0,0,0},
    extent={{0,-20},{0,20}},
    textString="%name",
    fontSize=14,
    textStyle={TextStyle.None},
    textColor={0,0,0},
    verticalAlignment=TextAlignment.Top)},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
grid={2,2})));
      block JuliaFunction "编辑和调用Julia脚本函数"
          annotation (defaultComponentName = "juliaFunction", __MWORKS(BlockSystem(blockKind=BlockKind.subSystem,bltBlockKind=BltBlockKind.juliaFunctionSystem,Subsystem(virtual=true,functionPack=FunctionPack.auto,functionName="",sourceFile=""),SampleTime(auto = true),SubSystem),PortArrangement(Left(in_n1,in_n2,in_n3,in_n4,in_d,in_ct,in_cm),Right(out_f,out_tao_x,out_tao_y,out_tao_z)),sourceModel=SysplorerEmbeddedCoder.Utilities.JuliaFunction,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-200,-100},{200,100}},
      grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
      rotationPolicy=RotationPolicy.Follow,
      origin={0,0},
      fillColor={255,255,255},
      fillPattern=FillPattern.Solid,
      lineThickness=3,
      extent={{-200,100},{200,-100}}), Text(origin={0,-75},
      lineColor={0,0,0},
      extent={{-200,20},{200,-20}},
      textString="%juliaFunctionName",
      fontSize=14,
      textStyle={TextStyle.None},
      textColor={0,0,0}), Text(origin={0,-120},
      lineColor={0,0,0},
      extent={{0,-20},{0,20}},
      textString="%name",
      fontSize=14,
      textStyle={TextStyle.None},
      textColor={0,0,0},
      verticalAlignment=TextAlignment.Top), Bitmap(origin={0,0},
      extent={{-40,-40},{40,40}},
      fileName="modelica://SysplorerEmbeddedCoder/Resources/Icons/JuliaFunction.svg")},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
      grid={2,2})),Protection(access=Access.packageDuplicate));

          block JuliaFunctionAtomic
              annotation (__MWORKS(BlockSystem(blockKind=Types.BlockKind.atomic,
                  bltBlockKind=Types.BltBlockKind.juliaFunction), hide=true),Protection(access=Access.packageDuplicate));
            SysplorerEmbeddedCoder.Types.InputAuto in_n1 annotation(Placement(transformation(origin={ -240,180 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,180 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_n2 annotation(Placement(transformation(origin={ -240,120 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,120 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_n3 annotation(Placement(transformation(origin={ -240,60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_n4 annotation(Placement(transformation(origin={ -240,0 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,0 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_d annotation(Placement(transformation(origin={ -240,-60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_ct annotation(Placement(transformation(origin={ -240,-120 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-120 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_cm annotation(Placement(transformation(origin={ -240,-180 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-180 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.OutputAuto out_f annotation(Placement(transformation(origin={ -240,90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
            SysplorerEmbeddedCoder.Types.OutputAuto out_tao_x annotation(Placement(transformation(origin={ -240,30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
            SysplorerEmbeddedCoder.Types.OutputAuto out_tao_y annotation(Placement(transformation(origin={ -240,-30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
            SysplorerEmbeddedCoder.Types.OutputAuto out_tao_z annotation(Placement(transformation(origin={ -240,-90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
            parameter String juliaScript = "function control_efficiency(n1,n2,n3,n4,d,ct,cm)\r\n    #控制效率模型\r\n    #X型机架\r\n    #3↓   1↑\r\n    #  \\ /\r\n    #  / \\\r\n    #2↑   4↓\r\n    #转速单位是弧度\r\n    f = -1*ct*(n1^2 + n2^2 + n3^2 + n4^2);#z轴朝下，所以拉力为负\r\n    tao_x = d*ct*sin(pi/4)*(-n1^2 + n2^2 + n3^2 - n4^2) / 2;\r\n    tao_y = d*ct*sin(pi/4)*(n1^2 - n2^2 + n3^2 - n4^2) / 2;\r\n    tao_z = cm*(n1^2 + n2^2 - n3^2 - n4^2);\r\n    #十字型\r\n    # f = ct*(n1^2 + n2^2 + n3^2 + n4^2);\r\n    # tao_x = -d*ct*n2^2 + d*ct*n4^2;\r\n    # tao_y =  d*ct*n1^2 - d*ct*n3^2;\r\n    # tao_z = cm*(n1^2 - n2^2 + n3^2 - n4^2);\r\n    return f,tao_x,tao_y,tao_z;\r\nend" annotation (HideResult = true);
            parameter String juliaObjectName = "control_efficiency" annotation (HideResult = true);
              end JuliaFunctionAtomic;

          JuliaFunctionAtomic juliaFunctionAtomic annotation(HideResult = true,__MWORKS(BlockSystem(Instance(in_n1(Type(ref="double"),Dimension=1),in_n2(Type(ref="double"),Dimension=1),in_n3(Type(ref="double"),Dimension=1),in_n4(Type(ref="double"),Dimension=1),in_d(Type(ref="double"),Dimension=1),in_ct(Type(ref="double"),Dimension=1),in_cm(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
        SysplorerEmbeddedCoder.Types.InputAuto in_n1 annotation(Placement(transformation(origin={ -240,180 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,180 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_n2 annotation(Placement(transformation(origin={ -240,120 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,120 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_n3 annotation(Placement(transformation(origin={ -240,60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_n4 annotation(Placement(transformation(origin={ -240,0 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,0 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_d annotation(Placement(transformation(origin={ -240,-60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_ct annotation(Placement(transformation(origin={ -240,-120 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-120 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_cm annotation(Placement(transformation(origin={ -240,-180 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-180 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.OutputAuto out_f annotation(Placement(transformation(origin={ -240,90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.OutputAuto out_tao_x annotation(Placement(transformation(origin={ -240,30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.OutputAuto out_tao_y annotation(Placement(transformation(origin={ -240,-30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.OutputAuto out_tao_z annotation(Placement(transformation(origin={ -240,-90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
        parameter String juliaFunctionName = "control_efficiency" annotation(HideResult = true);
          equation
        connect(in_n1, juliaFunctionAtomic.in_n1);
        connect(in_n2, juliaFunctionAtomic.in_n2);
        connect(in_n3, juliaFunctionAtomic.in_n3);
        connect(in_n4, juliaFunctionAtomic.in_n4);
        connect(in_d, juliaFunctionAtomic.in_d);
        connect(in_ct, juliaFunctionAtomic.in_ct);
        connect(in_cm, juliaFunctionAtomic.in_cm);
        connect(out_f, juliaFunctionAtomic.out_f);
        connect(out_tao_x, juliaFunctionAtomic.out_tao_x);
        connect(out_tao_y, juliaFunctionAtomic.out_tao_y);
        connect(out_tao_z, juliaFunctionAtomic.out_tao_z);
            end JuliaFunction;
      JuliaFunction juliaFunction 
        annotation (Placement(transformation(origin={-37,-8},
extent={{-13,-68},{13,68}})),__MWORKS(BlockSystem(SampleTime=-1)));
      SysplorerEmbeddedCoder.Port.Inport n1 
        annotation (Placement(transformation(origin={-184,50},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,90},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Inport n2 
        annotation (Placement(transformation(origin={-166,30.8571},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,30},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Inport n3 
        annotation (Placement(transformation(origin={-152,11.4286},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,-30},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Inport n4 
        annotation (Placement(transformation(origin={-130,-8},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,-90},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Sources.Constant constant1(k=ConEfficiency_drone_R) 
        annotation (Placement(transformation(origin={-185,-27.4286},
extent={{-43,-10},{43,10}})),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));
      SysplorerEmbeddedCoder.Sources.Constant constant2(k=ConEfficiency_drone_cT) 
        annotation (Placement(transformation(origin={-141,-52},
extent={{-43,-10},{43,10}})),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));
      SysplorerEmbeddedCoder.Sources.Constant constant3(k=ConEfficiency_drone_cM) 
        annotation (Placement(transformation(origin={-117,-84},
extent={{-43,-10},{43,10}})),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));
      SysplorerEmbeddedCoder.Port.Outport f 
        annotation (Placement(transformation(origin={38,42.9999952},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,90},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Outport tao_x 
        annotation (Placement(transformation(origin={38,8.9999952},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,30},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Outport tao_y 
        annotation (Placement(transformation(origin={38,-25},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-30},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Outport tao_z 
        annotation (Placement(transformation(origin={38,-59},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-90},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      equation
      connect(juliaFunction.in_n1, n1) 
      annotation(Line(origin={-89,53},
points={{37.2,-2.71429},{-83,-2.71429},{-83,-3}},
color={0,0,0}));
      connect(juliaFunction.in_n2, n2) 
      annotation(Line(origin={-89,39},
points={{37.2,-8.14286},{-65,-8.14286}},
color={0,0,0}));
      connect(juliaFunction.in_n3, n3) 
      annotation(Line(origin={-89,26},
points={{37.2,-14.5714},{-51,-14.5714}},
color={0,0,0}));
      connect(juliaFunction.in_n4, n4) 
      annotation(Line(origin={-89,12},
points={{37.2,-20},{-29,-20}},
color={0,0,0}));
      connect(juliaFunction.in_d, constant1.y) 
      annotation(Line(origin={-96,-27},
      points={{44.2,-0.428571},{-44.2,-0.428571}},
      color={0,0,0}));
      connect(juliaFunction.in_ct, constant2.y) 
      annotation(Line(origin={-120,-47},
points={{68.2,0.142857},{27.6,0.142857},{27.6,-5},{23.8,-5}},
color={0,0,0}));
      connect(constant3.y, juliaFunction.in_cm) 
      annotation(Line(origin={-138,-66},
points={{65.8,-18},{82.4,-18},{82.4,-0.285714},{86.2,-0.285714}},
color={0,0,0}));
      connect(juliaFunction.out_f, f) 
      annotation(Line(origin={2,43},
      points={{-24.2,0},{24,0}},
      color={0,0,0}));
      connect(juliaFunction.out_tao_z, tao_z) 
      annotation(Line(origin={2,-59},
      points={{-24.2,0},{24,0}},
      color={0,0,0}));
      connect(juliaFunction.out_tao_y, tao_y) 
      annotation(Line(origin={2,-25},
      points={{-24.2,0},{24,0}},
      color={0,0,0}));
      connect(tao_x, juliaFunction.out_tao_x) 
      annotation(Line(origin={2,9},
      points={{24,0},{-24.2,0}},
      color={0,0,0}));
      end SubSystem1;
    block SubSystem2 "选择子系统模块的设置。 要启用涉及代码生成的相关参数, 请选择 '视为原子单元' 。"

      annotation (defaultComponentName="subSystem", __MWORKS(PortArrangement(Left(f, yaw, pitch, roll), Right(vx_dot, vy_dot, vz_dot)),BlockSystem(blockKind=BlockKind.subSystem, SampleTime(auto=true), SubSystem(virtual=true, functionPack=FunctionPack.auto, functionName="", sourceFile="")),PortLabels(labelType="PortName"),sourceModel=SysplorerEmbeddedCoder.SubSystems.SubSystem,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-300,-120},{300,120}},
    grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
    rotationPolicy=RotationPolicy.Follow,
    origin={0,0},
    fillColor={255,255,255},
    fillPattern=FillPattern.Solid,
    lineThickness=3,
    extent={{-300,120},{300,-120}}), Text(origin={0,-140},
    lineColor={0,0,0},
    extent={{0,-20},{0,20}},
    textString="%name",
    fontSize=14,
    textStyle={TextStyle.None},
    textColor={0,0,0},
    verticalAlignment=TextAlignment.Top)},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
grid={2,2})));
      block JuliaFunction "编辑和调用Julia脚本函数"
          annotation (defaultComponentName = "juliaFunction", __MWORKS(BlockSystem(blockKind=BlockKind.subSystem,bltBlockKind=BltBlockKind.juliaFunctionSystem,Subsystem(virtual=true,functionPack=FunctionPack.auto,functionName="",sourceFile=""),SampleTime(auto = true),SubSystem),PortArrangement(Left(in_f,in_m,in_g,in_yaw,in_pitch,in_roll),Right(out_vx_dot,out_vy_dot,out_vz_dot)),sourceModel=SysplorerEmbeddedCoder.Utilities.JuliaFunction,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-200,-100},{200,100}},
      grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
      rotationPolicy=RotationPolicy.Follow,
      origin={0,0},
      fillColor={255,255,255},
      fillPattern=FillPattern.Solid,
      lineThickness=3,
      extent={{-200,100},{200,-100}}), Text(origin={0,-75},
      lineColor={0,0,0},
      extent={{-200,20},{200,-20}},
      textString="%juliaFunctionName",
      fontSize=14,
      textStyle={TextStyle.None},
      textColor={0,0,0}), Text(origin={0,-120},
      lineColor={0,0,0},
      extent={{0,-20},{0,20}},
      textString="%name",
      fontSize=14,
      textStyle={TextStyle.None},
      textColor={0,0,0},
      verticalAlignment=TextAlignment.Top), Bitmap(origin={0,0},
      extent={{-40,-40},{40,40}},
      fileName="modelica://SysplorerEmbeddedCoder/Resources/Icons/JuliaFunction.svg")},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
      grid={2,2})),Protection(access=Access.packageDuplicate));

          block JuliaFunctionAtomic
              annotation (__MWORKS(BlockSystem(blockKind=Types.BlockKind.atomic,
                  bltBlockKind=Types.BltBlockKind.juliaFunction), hide=true),Protection(access=Access.packageDuplicate));
            SysplorerEmbeddedCoder.Types.InputAuto in_f annotation(Placement(transformation(origin={ -240,150 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,150 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_m annotation(Placement(transformation(origin={ -240,90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_g annotation(Placement(transformation(origin={ -240,30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_yaw annotation(Placement(transformation(origin={ -240,-30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_pitch annotation(Placement(transformation(origin={ -240,-90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_roll annotation(Placement(transformation(origin={ -240,-150 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-150 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.OutputAuto out_vx_dot annotation(Placement(transformation(origin={ -240,60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
            SysplorerEmbeddedCoder.Types.OutputAuto out_vy_dot annotation(Placement(transformation(origin={ -240,0 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,0 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
            SysplorerEmbeddedCoder.Types.OutputAuto out_vz_dot annotation(Placement(transformation(origin={ -240,-60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
            parameter String juliaScript = "function pos_dyna(f,m,g,yaw,pitch,roll)\r\n    #位置动力学\r\n    #忽略了角速度和线速度的叉乘\r\n    vx_dot = (sin(roll)*sin(yaw) + cos(roll)*cos(yaw)*sin(pitch))*f/m;\r\n    vy_dot = (cos(roll)*sin(pitch)*sin(yaw) - cos(yaw)*sin(roll))*f/m;\r\n    vz_dot = (cos(pitch)*cos(roll)*f/m)+g;\r\n    return vx_dot,vy_dot,vz_dot\r\nend" annotation (HideResult = true);
            parameter String juliaObjectName = "pos_dyna" annotation (HideResult = true);
              end JuliaFunctionAtomic;

          JuliaFunctionAtomic juliaFunctionAtomic annotation(HideResult = true,__MWORKS(BlockSystem(Instance(in_f(Type(ref="double"),Dimension=1),in_m(Type(ref="double"),Dimension=1),in_g(Type(ref="double"),Dimension=1),in_yaw(Type(ref="double"),Dimension=1),in_pitch(Type(ref="double"),Dimension=1),in_roll(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
        SysplorerEmbeddedCoder.Types.InputAuto in_f annotation(Placement(transformation(origin={ -240,150 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,150 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_m annotation(Placement(transformation(origin={ -240,90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_g annotation(Placement(transformation(origin={ -240,30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_yaw annotation(Placement(transformation(origin={ -240,-30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_pitch annotation(Placement(transformation(origin={ -240,-90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_roll annotation(Placement(transformation(origin={ -240,-150 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-150 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.OutputAuto out_vx_dot annotation(Placement(transformation(origin={ -240,60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.OutputAuto out_vy_dot annotation(Placement(transformation(origin={ -240,0 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,0 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.OutputAuto out_vz_dot annotation(Placement(transformation(origin={ -240,-60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
        parameter String juliaFunctionName = "pos_dyna" annotation(HideResult = true);
          equation
        connect(in_f, juliaFunctionAtomic.in_f);
        connect(in_m, juliaFunctionAtomic.in_m);
        connect(in_g, juliaFunctionAtomic.in_g);
        connect(in_yaw, juliaFunctionAtomic.in_yaw);
        connect(in_pitch, juliaFunctionAtomic.in_pitch);
        connect(in_roll, juliaFunctionAtomic.in_roll);
        connect(out_vx_dot, juliaFunctionAtomic.out_vx_dot);
        connect(out_vy_dot, juliaFunctionAtomic.out_vy_dot);
        connect(out_vz_dot, juliaFunctionAtomic.out_vz_dot);
            end JuliaFunction;
      JuliaFunction juliaFunction 
        annotation (Placement(transformation(origin={-31,31},
extent={{-37,-87},{37,87}})),__MWORKS(BlockSystem(SampleTime=-1)));
      SysplorerEmbeddedCoder.Sources.Constant constant1(k=PosDyna_Mass) 
        annotation (Placement(transformation(origin={-190,74.5},
extent={{-34,-7.25},{34,7.25}})),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));
      SysplorerEmbeddedCoder.Sources.Constant constant2(k=PosDyna_GravityAcc) 
        annotation (Placement(transformation(origin={-190,46.875},
extent={{-34,-7.25},{34,7.25}})),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));
      SysplorerEmbeddedCoder.Port.Outport vx_dot 
        annotation (Placement(transformation(origin={76,88.9999952},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,80},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Outport vy_dot 
        annotation (Placement(transformation(origin={76,30.9999952},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,0},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Outport vz_dot 
        annotation (Placement(transformation(origin={76,-27},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-80},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Inport f 
        annotation (Placement(transformation(origin={-184,103.5},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,90},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Inport yaw 
        annotation (Placement(transformation(origin={-186,16.4999952},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,30},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Inport pitch 
        annotation (Placement(transformation(origin={-186,-12.5},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,-30},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Inport roll 
        annotation (Placement(transformation(origin={-186,-41.5},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,-90},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      equation
      connect(constant2.y, juliaFunction.in_g) 
      annotation(Line(origin={-112,46},
      points={{-42.2,0.875},{38.4,0.875},{38.4,-0.5},{42.2,-0.5}},
      color={0,0,0}));
      connect(constant1.y, juliaFunction.in_m) 
      annotation(Line(origin={-112,75},
      points={{-42.2,-0.5},{42.2,-0.5}},
      color={0,0,0}));
      connect(juliaFunction.out_vx_dot, vx_dot) 
      annotation(Line(origin={36,89},
      points={{-28.2,0},{28,0}},
      color={0,0,0}));
      connect(vy_dot, juliaFunction.out_vy_dot) 
      annotation(Line(origin={36,31},
      points={{28,0},{-28.2,0}},
      color={0,0,0}));
      connect(juliaFunction.out_vz_dot, vz_dot) 
      annotation(Line(origin={36,-27},
      points={{-28.2,0},{28,0}},
      color={0,0,0}));
      connect(juliaFunction.in_f, f) 
      annotation(Line(origin={-121,104},
      points={{51.2,-0.5},{-51,-0.5}},
      color={0,0,0}));
      connect(juliaFunction.in_yaw, yaw) 
      annotation(Line(origin={-122,17},
points={{52.2,-0.5},{-52,-0.5}},
color={0,0,0}));
      connect(juliaFunction.in_pitch, pitch) 
      annotation(Line(origin={-122,-12},
      points={{52.2,-0.5},{-52,-0.5}},
      color={0,0,0}));
      connect(juliaFunction.in_roll, roll) 
      annotation(Line(origin={-122,-41},
      points={{52.2,-0.5},{-52,-0.5}},
      color={0,0,0}));
      end SubSystem2;
    block SubSystem3 "选择子系统模块的设置。 要启用涉及代码生成的相关参数, 请选择 '视为原子单元' 。"

      annotation (defaultComponentName="subSystem", __MWORKS(PortArrangement(Left(vx_dot, vy_dot, vz_dot), Right(x_pos, y_pos, z_pos_minus, vec, z_pos_normal)),BlockSystem(blockKind=BlockKind.subSystem, SampleTime(auto=true), SubSystem(virtual=true, functionPack=FunctionPack.auto, functionName="", sourceFile="")),PortLabels(labelType="PortName"),sourceModel=SysplorerEmbeddedCoder.SubSystems.SubSystem,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-300,-120},{300,120}},
    grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
    rotationPolicy=RotationPolicy.Follow,
    origin={0,0},
    fillColor={255,255,255},
    fillPattern=FillPattern.Solid,
    lineThickness=3,
    extent={{-300,120},{300,-120}}), Text(origin={0,-140},
    lineColor={0,0,0},
    extent={{0,-20},{0,20}},
    textString="%name",
    fontSize=14,
    textStyle={TextStyle.None},
    textColor={0,0,0},
    verticalAlignment=TextAlignment.Top)},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
grid={2,2})));
      SysplorerEmbeddedCoder.Port.Inport vx_dot 
        annotation (Placement(transformation(origin={-22,66},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,80},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Inport vy_dot 
        annotation (Placement(transformation(origin={-22,30},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,0},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Inport vz_dot 
        annotation (Placement(transformation(origin={-22,-6},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,-80},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Continuous.Integrator integrator 
        annotation (Placement(transformation(origin={44,66.0000048},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Continuous.Integrator integrator1 
        annotation (Placement(transformation(origin={44,30.0000048},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Continuous.Integrator integrator2 
        annotation (Placement(transformation(origin={44,-6},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Continuous.Integrator integrator3 
        annotation (Placement(transformation(origin={120,66.0000048},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Continuous.Integrator integrator4 
        annotation (Placement(transformation(origin={120,30.0000048},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Continuous.Integrator integrator5 
        annotation (Placement(transformation(origin={120,-6},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Port.Outport x_pos 
        annotation (Placement(transformation(origin={204,66},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,96},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Outport y_pos 
        annotation (Placement(transformation(origin={204,30},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,48},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Outport z_pos_minus 
        annotation (Placement(transformation(origin={204,-6},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,0},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.SignalRouting.Mux mux(portNumber=3) 
        annotation (Placement(transformation(origin={160,-82},
extent={{-2,-32},{2,32}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=[3])),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Port.Outport vec 
        annotation (Placement(transformation(origin={204,-82},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-48},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=[3])));
      SysplorerEmbeddedCoder.MathOperation.Gain gain(k=-1) 
        annotation (Placement(transformation(origin={210,-42},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u(Type(ref="double"),Dimension=1),y(Type(ref="double"),Dimension=1),k(Type(ref=""),Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Port.Outport z_pos_normal 
        annotation (Placement(transformation(origin={274,-42},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-96},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      equation
      connect(vx_dot, integrator.u1) 
      annotation(Line(origin={11,66},
      points={{-21,4.8e-6},{21.2,4.8e-6}},
      color={0,0,0}));
      connect(vy_dot, integrator1.u1) 
      annotation(Line(origin={11,30},
      points={{-21,4.8e-6},{21.2,4.8e-6}},
      color={0,0,0}));
      connect(vz_dot, integrator2.u1) 
      annotation(Line(origin={11,-6},
points={{-21,4.8e-6},{21.2,0}},
color={0,0,0}));
      connect(integrator.y, integrator3.u1) 
      annotation(Line(origin={82,66},
      points={{-26.2,4.8e-6},{26.2,4.8e-6}},
      color={0,0,0}));
      connect(integrator1.y, integrator4.u1) 
      annotation(Line(origin={82,30},
      points={{-26.2,4.8e-6},{26.2,4.8e-6}},
      color={0,0,0}));
      connect(integrator2.y, integrator5.u1) 
      annotation(Line(origin={82,-6},
      points={{-26.2,4.8e-6},{26.2,4.8e-6}},
      color={0,0,0}));
      connect(integrator3.y, x_pos) 
      annotation(Line(origin={162,66},
      points={{-30.2,4.8e-6},{30,4.8e-6}},
      color={0,0,0}));
      connect(integrator4.y, y_pos) 
      annotation(Line(origin={162,30},
      points={{-30.2,4.8e-6},{30,4.8e-6}},
      color={0,0,0}));
      connect(z_pos_minus, integrator5.y) 
      annotation(Line(origin={162,-6},
      points={{30,4.8e-6},{-30.2,4.8e-6}},
      color={0,0,0}));
      connect(mux.y, vec) 
      annotation(Line(origin={178,-82},
      points={{-14.2,0},{14,0}},
      color={0,0,0}));
      connect(mux.u1, integrator.y) 
      annotation(Line(origin={106,3},
points={{50.2,-63.6667},{-10,-63.6667},{-10,63.0000048},{-50.2,63.0000048}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
      connect(mux.u2, integrator1.y) 
      annotation(Line(origin={106,-26},
points={{50.2,-56},{-22,-56},{-22,56.0000048},{-50.2,56.0000048}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
      connect(mux.u3, integrator2.y) 
      annotation(Line(origin={106,-55},
points={{50.2,-48.3333},{-30,-48.3333},{-30,49},{-50.2,49}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
      connect(gain.u, integrator5.y) 
      annotation(Line(origin={165,-24},
points={{33.2,-18},{-1,-18},{-1,18},{-33.2,18}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
      connect(gain.y, z_pos_normal) 
      annotation(Line(origin={242,-42},
      points={{-20.2,0},{20,0}},
      color={0,0,0}));
      end SubSystem3;
    block Scope "显示仿真过程中生成的信号"

      parameter String displayFormat = "y(t)" annotation(HideResult = true);

      parameter String showOnSimulator = "false" annotation(HideResult = true);

      SysplorerEmbeddedCoder.Types.InputAuto u1 
         annotation (Placement(transformation(origin={-110,0},
        extent={{-10,-10},{10,10}}),
        iconTransformation(origin={-101.8,0},
        extent={{-1.8,-1.8},{1.8,1.8}})),
          __MWORKS(BlockSystem(AllowDimension(choices(choice=DimensionType.scalar,
         choice=DimensionType.array1D,
    choice=DimensionType.scalar,choice=DimensionType.rowVector2D,choice=DimensionType.columnVector2D,choice=DimensionType.array2D)),
          AllowType(choices(choice = "double", choice = "float", choice = "int8", choice = "uint8", choice = "int16", choice = "uint16", choice = "int32",
          choice = "uint32", choice = "int64", choice = "uint64", choice = "string", choice = "boolean", choice = "enum")))));

      annotation(defaultComponentName = "scope", __MWORKS(BlockSystem(blockKind=Types.BlockKind.atomic, bltBlockKind=Types.BltBlockKind.scope),PortArrangement(Left(u1)),sourceModel=SysplorerEmbeddedCoder.Utilities.Scope,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-100,-100},{100,100}},
    grid={2,2}),graphics = {Rectangle(origin={0,0},
    fillColor={255,255,255},
    fillPattern=FillPattern.Solid,
    lineThickness=3,
    extent={{-100,100},{100,-100}},
    rotationPolicy=RotationPolicy.Follow), Rectangle(origin={1,54.5},
    fillColor={255,255,255},
    fillPattern=FillPattern.Solid,
    lineThickness=2,
    extent={{-79,24.5},{79,-24.5}},
    radius=10), Text(origin={0,-120},
    lineColor={0,0,0},
    extent={{0,-20},{0,20}},
    textString="%name",
    fontSize=14,
    textStyle={TextStyle.None},
    textColor={0,0,0},
    verticalAlignment=TextAlignment.Top)},rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate));

    end Scope;
    block Scope1 "显示仿真过程中生成的信号"

      parameter String displayFormat = "y(t)" annotation(HideResult = true);

      parameter String showOnSimulator = "false" annotation(HideResult = true);

      SysplorerEmbeddedCoder.Types.InputAuto u1 
         annotation (Placement(transformation(origin={-110,0},
        extent={{-10,-10},{10,10}}),
        iconTransformation(origin={-101.8,0},
        extent={{-1.8,-1.8},{1.8,1.8}})),
          __MWORKS(BlockSystem(AllowDimension(choices(choice=DimensionType.scalar,
         choice=DimensionType.array1D,
    choice=DimensionType.scalar,choice=DimensionType.rowVector2D,choice=DimensionType.columnVector2D,choice=DimensionType.array2D)),
          AllowType(choices(choice = "double", choice = "float", choice = "int8", choice = "uint8", choice = "int16", choice = "uint16", choice = "int32",
          choice = "uint32", choice = "int64", choice = "uint64", choice = "string", choice = "boolean", choice = "enum")))));

      annotation(defaultComponentName = "scope", __MWORKS(BlockSystem(blockKind=Types.BlockKind.atomic, bltBlockKind=Types.BltBlockKind.scope),PortArrangement(Left(u1)),sourceModel=SysplorerEmbeddedCoder.Utilities.Scope,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-100,-100},{100,100}},
    grid={2,2}),graphics = {Rectangle(origin={0,0},
    fillColor={255,255,255},
    fillPattern=FillPattern.Solid,
    lineThickness=3,
    extent={{-100,100},{100,-100}},
    rotationPolicy=RotationPolicy.Follow), Rectangle(origin={1,54.5},
    fillColor={255,255,255},
    fillPattern=FillPattern.Solid,
    lineThickness=2,
    extent={{-79,24.5},{79,-24.5}},
    radius=10), Text(origin={0,-120},
    lineColor={0,0,0},
    extent={{0,-20},{0,20}},
    textString="%name",
    fontSize=14,
    textStyle={TextStyle.None},
    textColor={0,0,0},
    verticalAlignment=TextAlignment.Top)},rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate));

    end Scope1;
    block Scope2 "显示仿真过程中生成的信号"

      parameter String displayFormat = "y(t)" annotation(HideResult = true);

      parameter String showOnSimulator = "false" annotation(HideResult = true);

      SysplorerEmbeddedCoder.Types.InputAuto u1 
         annotation (Placement(transformation(origin={-110,0},
        extent={{-10,-10},{10,10}}),
        iconTransformation(origin={-101.8,0},
        extent={{-1.8,-1.8},{1.8,1.8}})),
          __MWORKS(BlockSystem(AllowDimension(choices(choice=DimensionType.scalar,
         choice=DimensionType.array1D,
    choice=DimensionType.scalar,choice=DimensionType.rowVector2D,choice=DimensionType.columnVector2D,choice=DimensionType.array2D)),
          AllowType(choices(choice = "double", choice = "float", choice = "int8", choice = "uint8", choice = "int16", choice = "uint16", choice = "int32",
          choice = "uint32", choice = "int64", choice = "uint64", choice = "string", choice = "boolean", choice = "enum")))));

      annotation(defaultComponentName = "scope", __MWORKS(BlockSystem(blockKind=Types.BlockKind.atomic, bltBlockKind=Types.BltBlockKind.scope),PortArrangement(Left(u1)),sourceModel=SysplorerEmbeddedCoder.Utilities.Scope,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-100,-100},{100,100}},
    grid={2,2}),graphics = {Rectangle(origin={0,0},
    fillColor={255,255,255},
    fillPattern=FillPattern.Solid,
    lineThickness=3,
    extent={{-100,100},{100,-100}},
    rotationPolicy=RotationPolicy.Follow), Rectangle(origin={1,54.5},
    fillColor={255,255,255},
    fillPattern=FillPattern.Solid,
    lineThickness=2,
    extent={{-79,24.5},{79,-24.5}},
    radius=10), Text(origin={0,-120},
    lineColor={0,0,0},
    extent={{0,-20},{0,20}},
    textString="%name",
    fontSize=14,
    textStyle={TextStyle.None},
    textColor={0,0,0},
    verticalAlignment=TextAlignment.Top)},rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate));

    end Scope2;
    block SubSystem4 "选择子系统模块的设置。 要启用涉及代码生成的相关参数, 请选择 '视为原子单元' 。"

      annotation (defaultComponentName="subSystem", __MWORKS(PortArrangement(Left(tao_x, tao_y, tao_z), Right(wbx, wby, wbz, wb_vec)),BlockSystem(blockKind=BlockKind.subSystem, SampleTime(auto=true), SubSystem(virtual=true, functionPack=FunctionPack.auto, functionName="", sourceFile="")),PortLabels(labelType="PortName"),sourceModel=SysplorerEmbeddedCoder.SubSystems.SubSystem,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-300,-120},{300,120}},
    grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
    rotationPolicy=RotationPolicy.Follow,
    origin={0,0},
    fillColor={255,255,255},
    fillPattern=FillPattern.Solid,
    lineThickness=3,
    extent={{-300,120},{300,-120}}), Text(origin={0,-140},
    lineColor={0,0,0},
    extent={{0,-20},{0,20}},
    textString="%name",
    fontSize=14,
    textStyle={TextStyle.None},
    textColor={0,0,0},
    verticalAlignment=TextAlignment.Top)},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
grid={2,2})));
      block JuliaFunction "编辑和调用Julia脚本函数"
          annotation (defaultComponentName = "juliaFunction", __MWORKS(BlockSystem(blockKind=BlockKind.subSystem,bltBlockKind=BltBlockKind.juliaFunctionSystem,Subsystem(virtual=true,functionPack=FunctionPack.auto,functionName="",sourceFile=""),SampleTime(auto = true),SubSystem),PortArrangement(Left(in_Ixx,in_Iyy,in_Izz,in_tao_x,in_tao_y,in_tao_z),Right(out_wbx_dot,out_wby_dot,out_wbz_dot)),sourceModel=SysplorerEmbeddedCoder.Utilities.JuliaFunction,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-200,-100},{200,100}},
      grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
      rotationPolicy=RotationPolicy.Follow,
      origin={0,0},
      fillColor={255,255,255},
      fillPattern=FillPattern.Solid,
      lineThickness=3,
      extent={{-200,100},{200,-100}}), Text(origin={0,-75},
      lineColor={0,0,0},
      extent={{-200,20},{200,-20}},
      textString="%juliaFunctionName",
      fontSize=14,
      textStyle={TextStyle.None},
      textColor={0,0,0}), Text(origin={0,-120},
      lineColor={0,0,0},
      extent={{0,-20},{0,20}},
      textString="%name",
      fontSize=14,
      textStyle={TextStyle.None},
      textColor={0,0,0},
      verticalAlignment=TextAlignment.Top), Bitmap(origin={0,0},
      extent={{-40,-40},{40,40}},
      fileName="modelica://SysplorerEmbeddedCoder/Resources/Icons/JuliaFunction.svg")},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
      grid={2,2})),Protection(access=Access.packageDuplicate));

          block JuliaFunctionAtomic
              annotation (__MWORKS(BlockSystem(blockKind=Types.BlockKind.atomic,
                  bltBlockKind=Types.BltBlockKind.juliaFunction), hide=true),Protection(access=Access.packageDuplicate));
            SysplorerEmbeddedCoder.Types.InputAuto in_Ixx annotation(Placement(transformation(origin={ -240,150 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,150 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_Iyy annotation(Placement(transformation(origin={ -240,90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_Izz annotation(Placement(transformation(origin={ -240,30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_tao_x annotation(Placement(transformation(origin={ -240,-30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_tao_y annotation(Placement(transformation(origin={ -240,-90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_tao_z annotation(Placement(transformation(origin={ -240,-150 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-150 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.OutputAuto out_wbx_dot annotation(Placement(transformation(origin={ -240,60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
            SysplorerEmbeddedCoder.Types.OutputAuto out_wby_dot annotation(Placement(transformation(origin={ -240,0 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,0 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
            SysplorerEmbeddedCoder.Types.OutputAuto out_wbz_dot annotation(Placement(transformation(origin={ -240,-60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
            parameter String juliaScript = "function att_dyna(Ixx,Iyy,Izz,tao_x,tao_y,tao_z)\r\n    # wb = [wbx wby wbz]\';\r\n    # wb_cha = [   0 -wbz   wby;\r\n    #            wbz    0  -wbx;\r\n    #           -wby  wbx     0];\r\n    # I = [Ixx   0   0;\r\n    #        0 Iyy   0;\r\n    #        0   0 Izz];\r\n    I_inv = [1/Ixx     0     0;\r\n                 0 1/Iyy     0;\r\n                 0     0 1/Izz];\r\n    tao = [tao_x tao_y tao_z]\';\r\n    # G_x = Jrp * wby * (n1+n2-n3-n4);\r\n    # G_y = Jrp * wbx * (-n1-n2+n3+n4);\r\n    # G_z = 0;  \r\n    # G = [G_x G_y G_z]\';\r\n    wb_dot = I_inv * (tao);\r\n    wbx_dot = wb_dot[1,1];\r\n    wby_dot = wb_dot[2,1];\r\n    wbz_dot = wb_dot[3,1];\r\n    return  wbx_dot,wby_dot,wbz_dot;\r\nend" annotation (HideResult = true);
            parameter String juliaObjectName = "att_dyna" annotation (HideResult = true);
            end JuliaFunctionAtomic;

          JuliaFunctionAtomic juliaFunctionAtomic annotation(HideResult = true,__MWORKS(BlockSystem(Instance(in_Ixx(Type(ref="double"),Dimension=1),in_Iyy(Type(ref="double"),Dimension=1),in_Izz(Type(ref="double"),Dimension=1),in_tao_x(Type(ref="double"),Dimension=1),in_tao_y(Type(ref="double"),Dimension=1),in_tao_z(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
        SysplorerEmbeddedCoder.Types.InputAuto in_Ixx annotation(Placement(transformation(origin={ -240,150 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,150 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_Iyy annotation(Placement(transformation(origin={ -240,90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_Izz annotation(Placement(transformation(origin={ -240,30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_tao_x annotation(Placement(transformation(origin={ -240,-30 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-30 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_tao_y annotation(Placement(transformation(origin={ -240,-90 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-90 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_tao_z annotation(Placement(transformation(origin={ -240,-150 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-150 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.OutputAuto out_wbx_dot annotation(Placement(transformation(origin={ -240,60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.OutputAuto out_wby_dot annotation(Placement(transformation(origin={ -240,0 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,0 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.OutputAuto out_wbz_dot annotation(Placement(transformation(origin={ -240,-60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
        parameter String juliaFunctionName = "att_dyna" annotation(HideResult = true);
        equation
        connect(in_Ixx, juliaFunctionAtomic.in_Ixx);
        connect(in_Iyy, juliaFunctionAtomic.in_Iyy);
        connect(in_Izz, juliaFunctionAtomic.in_Izz);
        connect(in_tao_x, juliaFunctionAtomic.in_tao_x);
        connect(in_tao_y, juliaFunctionAtomic.in_tao_y);
        connect(in_tao_z, juliaFunctionAtomic.in_tao_z);
        connect(out_wbx_dot, juliaFunctionAtomic.out_wbx_dot);
        connect(out_wby_dot, juliaFunctionAtomic.out_wby_dot);
        connect(out_wbz_dot, juliaFunctionAtomic.out_wbz_dot);
        end JuliaFunction;
      JuliaFunction juliaFunction 
        annotation (Placement(transformation(origin={-72,-33},
extent={{-18,-83},{18,83}})),__MWORKS(BlockSystem(SampleTime=-1)));
      SysplorerEmbeddedCoder.Sources.Constant Ixx(k=AttDyna_Ixx) 
        annotation (Placement(transformation(origin={-174,36.1667},
extent={{-24,-8},{24,8}})),__MWORKS(ComponentName(textLocation=TextLocation.Left),BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));
      SysplorerEmbeddedCoder.Sources.Constant Iyy(k=AttDyna_Iyy) 
        annotation (Placement(transformation(origin={-174,8.5},
extent={{-24,-8},{24,8}})),__MWORKS(ComponentName(textLocation=TextLocation.Left),BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));
      SysplorerEmbeddedCoder.Sources.Constant Izz(k=AttDyna_Izz) 
        annotation (Placement(transformation(origin={-174,-24},
extent={{-24,-8},{24,8}})),__MWORKS(ComponentName(textLocation=TextLocation.Left),BlockSystem(SampleTime(auto=true,group="D0")=0,Instance(y(Type(ref="double"),Dimension=1),k(Type(ref="double"),Dimension=1)))));
      SysplorerEmbeddedCoder.Port.Inport tao_x 
        annotation (Placement(transformation(origin={-234,-54},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,80},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(ComponentName(textLocation=TextLocation.Left),BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Inport tao_y 
        annotation (Placement(transformation(origin={-234,-78},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,0},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(ComponentName(textLocation=TextLocation.Left),BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Inport tao_z 
        annotation (Placement(transformation(origin={-234,-106},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,-80},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(ComponentName(textLocation=TextLocation.Left),BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Continuous.Integrator integrator 
        annotation (Placement(transformation(origin={8,22.3333},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Port.Outport wbx 
        annotation (Placement(transformation(origin={106,22.3333},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,90},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Continuous.Integrator integrator1 
        annotation (Placement(transformation(origin={8,-33},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Continuous.Integrator integrator2 
        annotation (Placement(transformation(origin={8,-88.3333},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Port.Outport wby 
        annotation (Placement(transformation(origin={106,-33},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,30},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(ComponentName(textLocation=TextLocation.Bottom),BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Outport wbz 
        annotation (Placement(transformation(origin={106,-88.3333},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-30},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.SignalRouting.Mux mux(portNumber=3) 
        annotation (Placement(transformation(origin={200,-71.5},
extent={{-3.5,-75.5},{3.5,75.5}})),__MWORKS(BlockSystem(Instance(u(u1(Type(ref="double"),Dimension=1),u2(Type(ref="double"),Dimension=1),u3(Type(ref="double"),Dimension=1)),y(Type(ref="double"),Dimension=[3])),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Port.Outport wb_vec 
        annotation (Placement(transformation(origin={278,-71.5},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-90},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=[3])));
      equation
      connect(tao_x, juliaFunction.in_tao_x) 
      annotation(Line(origin={-157,-50},
points={{-65,-4},{61.4,-4},{61.4,3.16667},{65.2,3.16667}},
color={0,0,0}));
      connect(tao_y, juliaFunction.in_tao_y) 
      annotation(Line(origin={-157,-76},
points={{-65,-2},{61.4,-2},{61.4,1.5},{65.2,1.5}},
color={0,0,0}));
      connect(tao_z, juliaFunction.in_tao_z) 
      annotation(Line(origin={-157,-104},
points={{-65,-2},{61.4,-2},{61.4,1.83333},{65.2,1.83333}},
color={0,0,0}));
      connect(Ixx.y, juliaFunction.in_Ixx) 
      annotation(Line(origin={-120,36},
      points={{-28.2,0.1667},{28.2,0.166667}},
      color={0,0,0}));
      connect(Iyy.y, juliaFunction.in_Iyy) 
      annotation(Line(origin={-120,9},
      points={{-28.2,-0.5},{28.2,-0.5}},
      color={0,0,0}));
      connect(Izz.y, juliaFunction.in_Izz) 
      annotation(Line(origin={-120,-22},
      points={{-28.2,-2},{24.4,-2},{24.4,2.83333},{28.2,2.83333}},
      color={0,0,0}));
      connect(juliaFunction.out_wbx_dot, integrator.u1) 
      annotation(Line(origin={-28,22},
      points={{-24.2,0.333333},{24.2,0.333333}},
      color={0,0,0}));
      connect(integrator.y, wbx) 
      annotation(Line(origin={57,22},
      points={{-37.2,0.333333},{37,0.333333}},
      color={0,0,0}));
      connect(juliaFunction.out_wby_dot, integrator1.u1) 
      annotation(Line(origin={-28,-33},
      points={{-24.2,0},{24.2,0}},
      color={0,0,0}));
      connect(juliaFunction.out_wbz_dot, integrator2.u1) 
      annotation(Line(origin={-28,-88},
      points={{-24.2,-0.333333},{24.2,-0.333333}},
      color={0,0,0}));
      connect(integrator1.y, wby) 
      annotation(Line(origin={57,-33},
points={{-37.2,0},{37,0}},
color={0,0,0}));
      connect(integrator2.y, wbz) 
      annotation(Line(origin={57,-88},
      points={{-37.2,-0.333333},{37,-0.333333}},
      color={0,0,0}));
      connect(mux.u1, integrator.y) 
      annotation(Line(origin={103,8},
points={{91.7,-29.1667},{-79.4,-29.1667},{-79.4,14.3333},{-83.2,14.3333}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
      connect(mux.u2, integrator1.y) 
      annotation(Line(origin={103,-27},
points={{91.7,-44.5},{-79.4,-44.5},{-79.4,-6},{-83.2,-6}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
      connect(mux.u3, integrator2.y) 
      annotation(Line(origin={107,-105},
points={{87.7,-16.8333},{-55,-16.8333},{-55,16.6667},{-87.2,16.6667}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
      connect(mux.y, wb_vec) 
      annotation(Line(origin={236,-71},
      points={{-30.7,-0.5},{30,-0.5}},
      color={0,0,0}));
      end SubSystem4;
    block SubSystem5 "选择子系统模块的设置。 要启用涉及代码生成的相关参数, 请选择 '视为原子单元' 。"

      annotation (defaultComponentName="subSystem", __MWORKS(PortArrangement(Left(wbx, wby, wbz, pitch, roll), Right(roll_, pitch_, yaw, w_yaw)),BlockSystem(blockKind=BlockKind.subSystem, SampleTime(auto=true), SubSystem(virtual=true, functionPack=FunctionPack.auto, functionName="", sourceFile="")),PortLabels(labelType="PortName"),sourceModel=SysplorerEmbeddedCoder.SubSystems.SubSystem,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-300,-120},{300,120}},
    grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
    rotationPolicy=RotationPolicy.Follow,
    origin={0,0},
    fillColor={255,255,255},
    fillPattern=FillPattern.Solid,
    lineThickness=3,
    extent={{-300,120},{300,-120}}), Text(origin={0,-140},
    lineColor={0,0,0},
    extent={{0,-20},{0,20}},
    textString="%name",
    fontSize=14,
    textStyle={TextStyle.None},
    textColor={0,0,0},
    verticalAlignment=TextAlignment.Top)},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
grid={2,2})));
      block JuliaFunction "编辑和调用Julia脚本函数"
          annotation (defaultComponentName = "juliaFunction", __MWORKS(BlockSystem(blockKind=BlockKind.subSystem,bltBlockKind=BltBlockKind.juliaFunctionSystem,Subsystem(virtual=true,functionPack=FunctionPack.auto,functionName="",sourceFile=""),SampleTime(auto = true),SubSystem),PortArrangement(Left(in_wbx,in_wby,in_wbz,in_pitch,in_roll),Right(out_roll_dot,out_pitch_dot,out_yaw_dot)),sourceModel=SysplorerEmbeddedCoder.Utilities.JuliaFunction,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-200,-100},{200,100}},
      grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
      rotationPolicy=RotationPolicy.Follow,
      origin={0,0},
      fillColor={255,255,255},
      fillPattern=FillPattern.Solid,
      lineThickness=3,
      extent={{-200,100},{200,-100}}), Text(origin={0,-75},
      lineColor={0,0,0},
      extent={{-200,20},{200,-20}},
      textString="%juliaFunctionName",
      fontSize=14,
      textStyle={TextStyle.None},
      textColor={0,0,0}), Text(origin={0,-120},
      lineColor={0,0,0},
      extent={{0,-20},{0,20}},
      textString="%name",
      fontSize=14,
      textStyle={TextStyle.None},
      textColor={0,0,0},
      verticalAlignment=TextAlignment.Top), Bitmap(origin={0,0},
      extent={{-40,-40},{40,40}},
      fileName="modelica://SysplorerEmbeddedCoder/Resources/Icons/JuliaFunction.svg")},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
      grid={2,2})),Protection(access=Access.packageDuplicate));

          block JuliaFunctionAtomic
              annotation (__MWORKS(BlockSystem(blockKind=Types.BlockKind.atomic,
                  bltBlockKind=Types.BltBlockKind.juliaFunction), hide=true),Protection(access=Access.packageDuplicate));
            SysplorerEmbeddedCoder.Types.InputAuto in_wbx annotation(Placement(transformation(origin={ -240,120 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,120 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_wby annotation(Placement(transformation(origin={ -240,60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_wbz annotation(Placement(transformation(origin={ -240,0 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,0 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_pitch annotation(Placement(transformation(origin={ -240,-60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.InputAuto in_roll annotation(Placement(transformation(origin={ -240,-120 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-120 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
            SysplorerEmbeddedCoder.Types.OutputAuto out_roll_dot annotation(Placement(transformation(origin={ -240,60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
            SysplorerEmbeddedCoder.Types.OutputAuto out_pitch_dot annotation(Placement(transformation(origin={ -240,0 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,0 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
            SysplorerEmbeddedCoder.Types.OutputAuto out_yaw_dot annotation(Placement(transformation(origin={ -240,-60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
            parameter String juliaScript = "function att_kine(wbx,wby,wbz,pitch,roll)\r\n    #姿态运动学\r\n    roll_dot = wbx + tan(pitch)*sin(roll)*wby + tan(pitch)*cos(roll)*wbz;\r\n    pitch_dot = cos(roll)*wby - sin(roll)*wbz;\r\n    yaw_dot = (sin(roll)/cos(pitch))*wby + (cos(roll)/cos(pitch))*wbz;\r\n    return roll_dot,pitch_dot,yaw_dot;\r\nend\r\n    " annotation (HideResult = true);
            parameter String juliaObjectName = "att_kine" annotation (HideResult = true);
            end JuliaFunctionAtomic;

          JuliaFunctionAtomic juliaFunctionAtomic annotation(HideResult = true,__MWORKS(BlockSystem(Instance(in_wbx(Type(ref="double"),Dimension=1),in_wby(Type(ref="double"),Dimension=1),in_wbz(Type(ref="double"),Dimension=1),in_pitch(Type(ref="double"),Dimension=1),in_roll(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
        SysplorerEmbeddedCoder.Types.InputAuto in_wbx annotation(Placement(transformation(origin={ -240,120 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,120 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_wby annotation(Placement(transformation(origin={ -240,60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_wbz annotation(Placement(transformation(origin={ -240,0 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,0 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_pitch annotation(Placement(transformation(origin={ -240,-60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.InputAuto in_roll annotation(Placement(transformation(origin={ -240,-120 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-120 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.OutputAuto out_roll_dot annotation(Placement(transformation(origin={ -240,60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.OutputAuto out_pitch_dot annotation(Placement(transformation(origin={ -240,0 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,0 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
        SysplorerEmbeddedCoder.Types.OutputAuto out_yaw_dot annotation(Placement(transformation(origin={ -240,-60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
        parameter String juliaFunctionName = "att_kine" annotation(HideResult = true);
        equation
        connect(in_wbx, juliaFunctionAtomic.in_wbx);
        connect(in_wby, juliaFunctionAtomic.in_wby);
        connect(in_wbz, juliaFunctionAtomic.in_wbz);
        connect(in_pitch, juliaFunctionAtomic.in_pitch);
        connect(in_roll, juliaFunctionAtomic.in_roll);
        connect(out_roll_dot, juliaFunctionAtomic.out_roll_dot);
        connect(out_pitch_dot, juliaFunctionAtomic.out_pitch_dot);
        connect(out_yaw_dot, juliaFunctionAtomic.out_yaw_dot);
        end JuliaFunction;
      JuliaFunction juliaFunction 
        annotation (Placement(transformation(origin={-15,2},
extent={{-21,-58},{21,58}})),__MWORKS(BlockSystem(SampleTime=-1)));
      SysplorerEmbeddedCoder.Port.Inport wbx 
        annotation (Placement(transformation(origin={-110,48.4},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,96},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Inport wby 
        annotation (Placement(transformation(origin={-110,25.1999952},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,48},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Inport wbz 
        annotation (Placement(transformation(origin={-110,2},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,0},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Inport pitch 
        annotation (Placement(transformation(origin={-148,-21.2},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,-48},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Inport roll 
        annotation (Placement(transformation(origin={-202,-46},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={-301.8,-96},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Continuous.Integrator integrator 
        annotation (Placement(transformation(origin={92,40.6667},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Continuous.Integrator integrator1 
        annotation (Placement(transformation(origin={92,2},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Continuous.Integrator integrator2 
        annotation (Placement(transformation(origin={92,-36.6667},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(Instance(u1(Dimension=1),y(Dimension=1),initCond(Dimension=1),absoluteTolerance(Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Port.Outport roll_ 
        annotation (Placement(transformation(origin={176,40.6667},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,90},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Outport pitch_ 
        annotation (Placement(transformation(origin={176,2},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,30},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Outport yaw 
        annotation (Placement(transformation(origin={176,-36.6667},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-30},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      SysplorerEmbeddedCoder.Port.Outport w_yaw 
        annotation (Placement(transformation(origin={196,-70},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-90},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
      equation
      connect(wbx, juliaFunction.in_wbx) 
      annotation(Line(origin={-68,48},
      points={{-30,0.4},{30.2,0.4}},
      color={0,0,0}));
      connect(juliaFunction.in_wby, wby) 
      annotation(Line(origin={-68,25},
      points={{30.2,0.2},{-30,0.2}},
      color={0,0,0}));
      connect(juliaFunction.in_wbz, wbz) 
      annotation(Line(origin={-68,2},
      points={{30.2,-3.55271e-15},{-30,-2.88658e-15}},
      color={0,0,0}));
      connect(juliaFunction.in_pitch, pitch) 
      annotation(Line(origin={-68,-21},
points={{30.2,-0.2},{-68,-0.2}},
color={0,0,0}));
      connect(roll, juliaFunction.in_roll) 
      annotation(Line(origin={-68,-45},
points={{-122,-0.999995},{26.4,-0.999995},{26.4,0.6},{30.2,0.6}},
color={0,0,0}));
      connect(juliaFunction.out_roll_dot, integrator.u1) 
      annotation(Line(origin={44,41},
      points={{-36.2,-0.333333},{36.2,-0.333333}},
      color={0,0,0}));
      connect(juliaFunction.out_pitch_dot, integrator1.u1) 
      annotation(Line(origin={47,2},
points={{-39.2,-3.77476e-15},{33.2,-3.77476e-15}},
color={0,0,0}));
      connect(juliaFunction.out_yaw_dot, integrator2.u1) 
      annotation(Line(origin={47,-37},
points={{-39.2,0.333333},{33.2,0.333333}},
color={0,0,0}));
      connect(integrator.y, roll_) 
      annotation(Line(origin={134,41},
      points={{-30.2,-0.333333},{30,-0.333333}},
      color={0,0,0}));
      connect(pitch_, integrator1.y) 
      annotation(Line(origin={134,2},
      points={{30,-3.77476e-15},{-30.2,-3.55271e-15}},
      color={0,0,0}));
      connect(integrator2.y, yaw) 
      annotation(Line(origin={134,-37},
      points={{-30.2,0.333333},{30,0.333333}},
      color={0,0,0}));
      connect(w_yaw, juliaFunction.out_yaw_dot) 
      annotation(Line(origin={96,-53},
points={{88,-17},{-52,-17},{-52,16.3333},{-88.2,16.3333}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
      end SubSystem5;
  equation
    connect(pwm, saturation.u) 
    annotation(Line(origin={-102,-1},
    points={{-7.99997,0.154223},{8.2,0.154223}},
    color={0,0,0}));
    connect(saturation.y, deMux.u) 
    annotation(Line(origin={-59,-1},
    points={{-11.2,0.154223},{11.2,0.154223}},
    color={0,0,0}));
    connect(deMux.y1, subSystem.u) 
    annotation(Line(origin={-14,17},
    points={{-26.2,0.154223},{26.2,0.154223}},
    color={0,0,0}));
    connect(deMux.y2, subSystem.u1) 
    annotation(Line(origin={-14,5},
    points={{-26.2,0.154223},{26.2,0.154223}},
    color={0,0,0}));
    connect(deMux.y3, subSystem.u2) 
    annotation(Line(origin={-14,-7},
    points={{-26.2,0.154223},{26.2,0.154223}},
    color={0,0,0}));
    connect(deMux.y4, subSystem.u3) 
    annotation(Line(origin={-14,-19},
    points={{-26.2,0.154223},{26.2,0.154223}},
    color={0,0,0}));
    connect(subSystem.y, deMux1.u) 
    annotation(Line(origin={112,46},
points={{-36.2,-46.845777},{28.2,-46.845777},{28.2,-46.5}},
color={0,0,0}));
    connect(deMux1.y1, subSystem1.n1) 
    annotation(Line(origin={162,31.5},
points={{-14.2,0.25},{14.2,0.25}},
color={0,0,0}));
    connect(deMux1.y2, subSystem1.n2) 
    annotation(Line(origin={162,10.5},
points={{-14.2,-0.25},{14.2,-0.25}},
color={0,0,0}));
    connect(deMux1.y3, subSystem1.n3) 
    annotation(Line(origin={162,-11.5},
points={{-14.2,0.25},{14.2,0.25}},
color={0,0,0}));
    connect(deMux1.y4, subSystem1.n4) 
    annotation(Line(origin={162,-32.5},
points={{-14.2,-0.25},{14.2,-0.25}},
color={0,0,0}));
    connect(subSystem1.f, subSystem2.f) 
    annotation(Line(origin={316,50.5},
points={{-76.2,-18.75},{-40,-18.75},{-40,19.625},{76.2,19.625}},
color={0,0,0}));
    connect(subSystem2.vx_dot, subSystem3.vx_dot) 
    annotation(Line(origin={480,67.5},
points={{-24.2,0.166667},{24.2,0.166667}},
color={0,0,0}));
    connect(subSystem2.vy_dot, subSystem3.vy_dot) 
    annotation(Line(origin={480,48.5},
points={{-24.2,-0.5},{24.2,-0.5}},
color={0,0,0}));
    connect(subSystem2.vz_dot, subSystem3.vz_dot) 
    annotation(Line(origin={480,28.5},
points={{-24.2,-0.166667},{24.2,-0.166667}},
color={0,0,0}));
    connect(mux.u1, subSystem3.x_pos) 
    annotation(Line(origin={617,74.5},
points={{65.2,3.3},{17,3.3},{17,-2.9},{-65.2,-2.9}},
color={0,0,0}));
    connect(mux.u2, subSystem3.y_pos) 
    annotation(Line(origin={617,59.5},
points={{65.2,0.3},{-65.2,0.3}},
color={0,0,0}));
    connect(mux.u3, subSystem3.z_pos_minus) 
    annotation(Line(origin={617,44.5},
points={{65.2,-2.7},{-61.4,-2.7},{-61.4,3.5},{-65.2,3.5}},
color={0,0,0}));
    connect(x_pos.u1, subSystem3.x_pos) 
    annotation(Line(origin={592,85.5},
points={{40.2,31},{2,31},{2,-13.9},{-40.2,-13.9}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
    connect(y_pos.u1, subSystem3.y_pos) 
    annotation(Line(origin={622,88.5},
points={{88.2,13.5},{34,13.5},{34,-28.7},{-70.2,-28.7}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
    connect(mux.y, POS) 
    annotation(Line(origin={704,59.5},
points={{-14.2,0.3},{14,0.300005}},
color={0,0,0}));
    connect(vec, subSystem3.vec) 
    annotation(Line(origin={628,22.5},
points={{76,-14},{9.76344,-14},{9.76344,13.7},{-76.2,13.7}},
color={0,0,0}));
    connect(z_pos.u1, subSystem3.z_pos_normal) 
    annotation(Line(origin={575,19.5},
points={{23.2,-5},{-19.4,-5},{-19.4,4.9},{-23.2,4.9}},
color={0,0,0}));
    connect(subSystem1.tao_x, subSystem4.tao_x) 
    annotation(Line(origin={274,-0.5},
points={{-34.2,10.75},{30.4,10.75},{30.4,-59.7083},{34.2,-59.7083}},
color={0,0,0}));
    connect(subSystem1.tao_y, subSystem4.tao_y) 
    annotation(Line(origin={274,-27.5},
points={{-34.2,16.25},{18,16.25},{18,-66.125},{34.2,-66.125}},
color={0,0,0}));
    connect(subSystem1.tao_z, subSystem4.tao_z) 
    annotation(Line(origin={274,-55.5},
points={{-34.2,22.75},{6,22.75},{6,-71.5417},{34.2,-71.5417}},
color={0,0,0}));
    connect(subSystem4.wbx, subSystem5.wbx) 
    annotation(Line(origin={394,-65.4583},
points={{-48.2,9.42705},{44.4,9.42705},{44.4,-8.775},{48.2,-8.775}},
color={0,0,0}));
    connect(subSystem4.wby, subSystem5.wby) 
    annotation(Line(origin={394,-87.4583},
points={{-48.2,6.36455},{44.4,6.36455},{44.4,-6.825},{48.2,-6.825}},
color={0,0,0}));
    connect(subSystem4.wbz, subSystem5.wbz) 
    annotation(Line(origin={394,-110.45833},
points={{-48.2,4.30208},{44.4,4.30208},{44.4,-3.87497},{48.2,-3.87497}},
color={0,0,0}));
    connect(subSystem4.wb_vec, wb_vec) 
    annotation(Line(origin={359,-142.4583},
points={{-13.2,11.2396},{7.66151,11.2396},{7.66151,-12},{13,-12}},
color={0,0,0}));
    connect(subSystem5.roll_, subSystem2.roll) 
    annotation(Line(origin={439,-25.5},
points={{46.8,-51.2396},{50.6,-51.2396},{50.6,0},{-65,0},{-65,51.375},{-46.8,51.375}},
color={0,0,0}));
    connect(subSystem5.pitch_, subSystem2.pitch) 
    annotation(Line(origin={439,-30.5},
points={{46.8,-71.30205},{67,-71.30205},{67,-1},{-75,-1},{-75,71.125},{-46.8,71.125}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
    connect(subSystem5.yaw, subSystem2.yaw) 
    annotation(Line(origin={439,-35.5},
points={{46.8,-91.3646},{83,-91.3646},{83,-8},{-83,-8},{-83,90.875},{-46.8,90.875}},
color={0,0,0}));
    connect(subSystem5.w_yaw, w_yaw) 
    annotation(Line(origin={507,-151.5},
points={{-21.2,-0.42705},{21,-0.427095}},
color={0,0,0}));
    connect(mux1.y, Euler) 
    annotation(Line(origin={663,-76.5},
points={{-31.2,-0.23955},{31,-0.23955}},
color={0,0,0}));
    connect(mux1.u1, subSystem5.roll_) 
    annotation(Line(origin={555,-67.5},
points={{69.2,9.42712},{-65.4,9.42712},{-65.4,-9.23955},{-69.2,-9.23955}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
    connect(mux1.u2, subSystem5.pitch_) 
    annotation(Line(origin={555,-89.5},
points={{69.2,12.7604},{-49,12.7604},{-49,-12.302},{-69.2,-12.302}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
    connect(mux1.u3, subSystem5.yaw) 
    annotation(Line(origin={555,-111.5},
points={{69.2,16.0938},{-33,16.0938},{-33,-15.3646},{-69.2,-15.3646}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
    connect(subSystem5.roll, subSystem5.roll_) 
    annotation(Line(origin={464,-108},
points={{-21.8,-46.4333},{-54,-46.4333},{-54,98},{25.6,98},{25.6,31.2605},{21.8,31.2605}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
    connect(subSystem5.pitch, subSystem5.pitch_) 
    annotation(Line(origin={464,-98},
points={{-21.8,-36.3833},{-25.6,-36.3833},{-25.6,-122},{32,-122},{32,-3.80205},{21.8,-3.80205}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
    connect(mux2.y, pos_state) 
    annotation(Line(origin={763,-37},
    points={{-14.2,-7.10543e-15},{15,0}},
    color={0,0,0}));
    connect(mux2.u1, subSystem3.x_pos) 
    annotation(Line(origin={646,30},
points={{93.2,-41},{22,-41},{22,41.6},{-94.2,41.6}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
    connect(mux2.u2, subSystem3.y_pos) 
    annotation(Line(origin={646,11},
points={{93.2,-48},{-4,-48},{-4,48.8},{-94.2,48.8}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
    connect(mux2.u3, subSystem3.z_pos_normal) 
    annotation(Line(origin={646,-19},
    points={{93.2,-44},{-10.4,-44},{-10.4,-27.7396},{-90.4,-27.7396},{-90.4,43.4},{-94.2,43.4}},
    color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
    end SubSystem2;
  block Scope "显示仿真过程中生成的信号"

    parameter String displayFormat = "y(t)" annotation(HideResult = true);

    parameter String showOnSimulator = "false" annotation(HideResult = true);

    SysplorerEmbeddedCoder.Types.InputAuto u1 
       annotation (Placement(transformation(origin={-110,0},
      extent={{-10,-10},{10,10}}),
      iconTransformation(origin={-101.8,0},
      extent={{-1.8,-1.8},{1.8,1.8}})),
        __MWORKS(BlockSystem(AllowDimension(choices(choice=DimensionType.scalar,
       choice=DimensionType.array1D,
  choice=DimensionType.scalar,choice=DimensionType.rowVector2D,choice=DimensionType.columnVector2D,choice=DimensionType.array2D)),
        AllowType(choices(choice = "double", choice = "float", choice = "int8", choice = "uint8", choice = "int16", choice = "uint16", choice = "int32",
        choice = "uint32", choice = "int64", choice = "uint64", choice = "string", choice = "boolean", choice = "enum")))));

    annotation(defaultComponentName = "scope", __MWORKS(BlockSystem(blockKind=Types.BlockKind.atomic, bltBlockKind=Types.BltBlockKind.scope),PortArrangement(Left(u1)),sourceModel=SysplorerEmbeddedCoder.Utilities.Scope,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-100,-100},{100,100}},
  grid={2,2}),graphics = {Rectangle(origin={0,0},
  fillColor={255,255,255},
  fillPattern=FillPattern.Solid,
  lineThickness=3,
  extent={{-100,100},{100,-100}},
  rotationPolicy=RotationPolicy.Follow), Rectangle(origin={1,54.5},
  fillColor={255,255,255},
  fillPattern=FillPattern.Solid,
  lineThickness=2,
  extent={{-79,24.5},{79,-24.5}},
  radius=10), Text(origin={0,-120},
  lineColor={0,0,0},
  extent={{0,-20},{0,20}},
  textString="%name",
  fontSize=14,
  textStyle={TextStyle.None},
  textColor={0,0,0},
  verticalAlignment=TextAlignment.Top)},rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate));

  end Scope;
  block SubSystem3 "选择子系统模块的设置。 要启用涉及代码生成的相关参数, 请选择 '视为原子单元' 。"

    annotation (defaultComponentName="subSystem", __MWORKS(PortArrangement(Right(x_d, y_d, z_d)),BlockSystem(blockKind=BlockKind.subSystem, SampleTime(auto=true), SubSystem(virtual=true, functionPack=FunctionPack.auto, functionName="", sourceFile="")),PortLabels(labelType="PortName"),sourceModel=SysplorerEmbeddedCoder.SubSystems.SubSystem,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-300,-120},{300,120}},
  grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
  rotationPolicy=RotationPolicy.Follow,
  origin={0,0},
  fillColor={255,255,255},
  fillPattern=FillPattern.Solid,
  lineThickness=3,
  extent={{-300,120},{300,-120}}), Text(origin={0,-140},
  lineColor={0,0,0},
  extent={{0,-20},{0,20}},
  textString="%name",
  fontSize=14,
  textStyle={TextStyle.None},
  textColor={0,0,0},
  verticalAlignment=TextAlignment.Top)},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Protection(access=Access.packageDuplicate),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
grid={2,2})));
    block JuliaFunction1 "编辑和调用Julia脚本函数"
        annotation (defaultComponentName = "juliaFunction", __MWORKS(BlockSystem(blockKind=BlockKind.subSystem,bltBlockKind=BltBlockKind.juliaFunctionSystem,Subsystem(virtual=true,functionPack=FunctionPack.auto,functionName="",sourceFile=""),SampleTime(auto = true),SubSystem),PortArrangement(Left(in_t),Right(out_x_d,out_y_d,out_z_d)),sourceModel=SysplorerEmbeddedCoder.Utilities.JuliaFunction,independentInstance=true,hide=true), Icon(coordinateSystem(extent={{-200,-100},{200,100}},
    grid={2,2}),graphics = {Rectangle(sizePolicy=SizePolicy.Expanding,
    rotationPolicy=RotationPolicy.Follow,
    origin={0,0},
    fillColor={255,255,255},
    fillPattern=FillPattern.Solid,
    lineThickness=3,
    extent={{-200,100},{200,-100}}), Text(origin={0,-75},
    lineColor={0,0,0},
    extent={{-200,20},{200,-20}},
    textString="%juliaFunctionName",
    fontSize=14,
    textStyle={TextStyle.None},
    textColor={0,0,0}), Text(origin={0,-120},
    lineColor={0,0,0},
    extent={{0,-20},{0,20}},
    textString="%name",
    fontSize=14,
    textStyle={TextStyle.None},
    textColor={0,0,0},
    verticalAlignment=TextAlignment.Top), Bitmap(origin={0,0},
    extent={{-40,-40},{40,40}},
    fileName="modelica://SysplorerEmbeddedCoder/Resources/Icons/JuliaFunction.svg")},sizePolicy=SizePolicy.Fixed,rotationPolicy=RotationPolicy.Ignore),Diagram(coordinateSystem(extent={{-100,-100},{100,100}},
    grid={2,2})),Protection(access=Access.packageDuplicate));

        block JuliaFunctionAtomic
            annotation (__MWORKS(BlockSystem(blockKind=Types.BlockKind.atomic,
                bltBlockKind=Types.BltBlockKind.juliaFunction), hide=true),Protection(access=Access.packageDuplicate));
          SysplorerEmbeddedCoder.Types.InputAuto in_t annotation(Placement(transformation(origin={ -240,0 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,0 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.auto),Type(inherit=InheritType.auto,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus"))))));
          SysplorerEmbeddedCoder.Types.OutputAuto out_x_d annotation(Placement(transformation(origin={ -240,60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
          SysplorerEmbeddedCoder.Types.OutputAuto out_y_d annotation(Placement(transformation(origin={ -240,0 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,0 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
          SysplorerEmbeddedCoder.Types.OutputAuto out_z_d annotation(Placement(transformation(origin={ -240,-60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true)=-1,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice = "double",choice = "float",choice = "int8",choice = "uint8",choice = "int16",choice = "uint16",choice = "int32",choice = "uint32",choice = "int64",choice = "uint64",choice = "string",choice = "boolean",choice = "fixdt(1,16,0)",choice = "fixdt(1,16,2^0,0)",choice = "fixdt(1,16,1.0,0,0.0)",choice = "bus")),ref="double"),funcReturn=true)));
          parameter String juliaScript = "function compute(t)\r\n    # 初始化期望位置\r\n    x_d = 0.0\r\n    y_d = 0.0\r\n    z_d = 0.0\r\n    \r\n    # 阶段1: 0-5s 数值上升10m\r\n    if t >= 0 && t < 5\r\n        z_d = 10.0 * t / 5.0  # 匀速上升\r\n        x_d = 0.0\r\n        y_d = 0.0\r\n    \r\n    # 阶段2: 5-10s 保持悬停\r\n    elseif t >= 5 && t < 10\r\n        z_d = 10.0\r\n        x_d = 0.0\r\n        y_d = 0.0\r\n    \r\n    # 阶段3: 10-15s 竖直上升15m\r\n    elseif t >= 10 && t < 15\r\n        z_d = 10.0 + 15.0 * (t - 10) / 5.0  # 从10m上升到25m\r\n        x_d = 0.0\r\n        y_d = 0.0\r\n    \r\n    # 阶段4: 15-20s 保持悬停 (您未指定，但为了连续性添加)\r\n    elseif t >= 15 && t < 20\r\n        z_d = 25.0\r\n        x_d = 0.0\r\n        y_d = 0.0\r\n    \r\n    # 阶段5: 20-30s X方向运动10m\r\n    elseif t >= 20 && t < 30\r\n        z_d = 25.0\r\n        x_d = 10.0 * (t - 20) / 10.0  # X方向运动10m\r\n        y_d = 0.0\r\n    \r\n    # 阶段6: 30-40s Y方向运动10m\r\n    elseif t >= 30 && t < 40\r\n        z_d = 25.0\r\n        x_d = 10.0\r\n        y_d = 10.0 * (t - 30) / 10.0  # Y方向运动10m\r\n    \r\n    # 阶段7: 40s后保持最终位置\r\n    else\r\n        z_d = 25.0\r\n        x_d = 10.0\r\n        y_d = 10.0\r\n    end\r\n    \r\n    return x_d, y_d, z_d\r\nend" annotation (HideResult = true);
          parameter String juliaObjectName = "compute" annotation (HideResult = true);
          end JuliaFunctionAtomic;

        JuliaFunctionAtomic juliaFunctionAtomic annotation(HideResult = true,__MWORKS(BlockSystem(Instance(in_t(Type(ref="double"),Dimension=1)),SampleTime(group="D0")=0)));
      SysplorerEmbeddedCoder.Types.InputAuto in_t annotation(Placement(transformation(origin={ -240,0 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,0 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.auto)=1,Type(inherit=InheritType.auto,allowTypes(choices(choice="bus")),ref="double"))));
      SysplorerEmbeddedCoder.Types.OutputAuto out_x_d annotation(Placement(transformation(origin={ -240,60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
      SysplorerEmbeddedCoder.Types.OutputAuto out_y_d annotation(Placement(transformation(origin={ -240,0 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,0 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
      SysplorerEmbeddedCoder.Types.OutputAuto out_z_d annotation(Placement(transformation(origin={ -240,-60 },extent={ {-6.5,-6.5},{6.5,6.5} }),iconTransformation(origin={ -301.8,-60 },extent={ {-1.8,-1.8},{1.8,1.8} })),__MWORKS(BlockSystem(SampleTime(auto=true,group="D0")=0,Dimension(dimensionType=DimensionType.none)=1,Type(inherit=InheritType.none,allowTypes(choices(choice="bus")),ref="double"))));
      parameter String juliaFunctionName = "compute" annotation(HideResult = true);
      equation
      connect(in_t, juliaFunctionAtomic.in_t);
      connect(out_x_d, juliaFunctionAtomic.out_x_d);
      connect(out_y_d, juliaFunctionAtomic.out_y_d);
      connect(out_z_d, juliaFunctionAtomic.out_z_d);
      end JuliaFunction1;
    JuliaFunction1 juliaFunction1 
      annotation (Placement(transformation(origin={-12,8},
extent={{-24,-34},{24,34}})),__MWORKS(BlockSystem(SampleTime=-1)));
    SysplorerEmbeddedCoder.Sources.Clock clock 
      annotation (Placement(transformation(origin={-108,8},
extent={{-10,-10},{10,10}})),__MWORKS(BlockSystem(SampleTime(group="D0")=0)));
    SysplorerEmbeddedCoder.Port.Outport x_d 
      annotation (Placement(transformation(origin={76,30.6667},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,80},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(ComponentName(textLocation=TextLocation.Right),BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.Port.Outport y_d 
      annotation (Placement(transformation(origin={76,8},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,0},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(ComponentName(textLocation=TextLocation.Right),BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
    SysplorerEmbeddedCoder.Port.Outport z_d 
      annotation (Placement(transformation(origin={76,-14.6667},
extent={{-10,-10},{10,10}}),
iconTransformation(origin={301.8,-80},
extent={{-1.8,-1.8},{1.8,1.8}})),__MWORKS(ComponentName(textLocation=TextLocation.Right),BlockSystem(SampleTime(group="D0")=0,Type(ref="double"),Dimension=1)));
  equation
    connect(clock.y, juliaFunction1.in_t) 
    annotation(Line(origin={-67,8},
    points={{-29.2,-3.55271e-15},{29.2,-3.55271e-15}},
    color={0,0,0}));
    connect(juliaFunction1.out_x_d, x_d) 
    annotation(Line(origin={39,31},
points={{-25.2,-0.333333},{25,-0.333333}},
color={0,0,0}));
    connect(juliaFunction1.out_y_d, y_d) 
    annotation(Line(origin={39,8},
points={{-25.2,-3.55271e-15},{25,-3.55271e-15}},
color={0,0,0}));
    connect(z_d, juliaFunction1.out_z_d) 
    annotation(Line(origin={39,-15},
points={{25,0.333333},{-25.2,0.333333}},
color={0,0,0}));
    end SubSystem3;
equation
  connect(subSystem.roll_d, subSystem1.roll_deg_d) 
  annotation(Line(origin={-7,37},
points={{-45.2,-23.8},{-1,-23.8},{-1,9.8},{77.2,9.8}},
color={0,0,0}));
  connect(subSystem.pitch_d, subSystem1.pitch_deg_d) 
  annotation(Line(origin={-7,22},
points={{-45.2,-25.6},{47,-25.6},{47,10.4},{77.2,10.4}},
color={0,0,0}));
  connect(subSystem1.yaw_deg_d, step.y) 
  annotation(Line(origin={49,17.6},
points={{21.2,0.4},{-21.2,0.4}},
color={0,0,0}));
  connect(subSystem.Thrust_desire, juliaFunction.in_thrust) 
  annotation(Line(origin={66,65},
points={{-118.2,-1.4},{118.2,-1.4},{118.2,-1.7125}},
color={0,0,0}));
  connect(subSystem1.roll_pwm, juliaFunction.in_roll_pwm) 
  annotation(Line(origin={165,41},
points={{-19.2,1},{15.4,1},{15.4,-0.9375},{19.2,-0.9375}},
color={0,0,0}));
  connect(subSystem1.pitch_pwm, juliaFunction.in_pitch_pwm) 
  annotation(Line(origin={165,18},
points={{-19.2,0},{15.4,0},{15.4,-1.1625},{19.2,-1.1625}},
color={0,0,0}));
  connect(subSystem1.yaw_pwm, juliaFunction.in_yaw_pwm) 
  annotation(Line(origin={165,-5},
points={{-19.2,-1},{19.2,-1},{19.2,-1.3875}},
color={0,0,0}));
  connect(juliaFunction.out_m1, mux.u1) 
  annotation(Line(origin={246,62},
points={{-28.2,1.2875},{26.2,1.2875}},
color={0,0,0}));
  connect(juliaFunction.out_m2, mux.u2) 
  annotation(Line(origin={246,39},
points={{-28.2,1.0625},{26.2,1.0625}},
color={0,0,0}));
  connect(juliaFunction.out_m3, mux.u3) 
  annotation(Line(origin={245,17},
  points={{-27.2,-0.1625},{27.2,-0.1625}},
  color={0,0,0}));
  connect(juliaFunction.out_m4, mux.u4) 
  annotation(Line(origin={245,-6},
  points={{-27.2,-0.3875},{27.2,-0.3875}},
  color={0,0,0}));
  connect(mux.y, subSystem2.pwm) 
  annotation(Line(origin={321,28},
points={{-41.2,0.45},{-4.8,0.45}},
color={0,0,0}));
  connect(subSystem2.POS, subSystem.pos_act) 
  annotation(Line(origin={185,86},
points={{250.8,14.45},{300.6,14.45},{300.6,54},{-335,54},{-335,-35},{-296.8,-35}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
  connect(subSystem2.vec, subSystem.v_act) 
  annotation(Line(origin={163,79},
points={{272.8,-14.55},{278.6,-14.55},{278.6,51},{-323,51},{-323,-42},{-274.8,-42}},
color={0,0,0}));
  connect(subSystem2.Euler, subSystem.euler_act) 
  annotation(Line(origin={162,-53},
points={{273.8,9.45},{277.6,9.45},{277.6,-48.05},{-318,-48.05},{-318,48},{-273.8,48}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
  connect(subSystem1.wb_act, subSystem2.wb_vec) 
  annotation(Line(origin={253,62},
points={{-182.8,-58.4},{-197,-58.4},{-197,-144},{207,-144},{207,-33.55},{182.8,-33.55}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
  connect(subSystem1.Euler_act, subSystem2.Euler) 
  annotation(Line(origin={253,-56},
points={{-182.8,45.2},{-186.6,45.2},{-186.6,-45.05},{186.6,-45.05},{186.6,12.45},{182.8,12.45}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
  connect(scope.u1, subSystem2.POS) 
  annotation(Line(origin={489,100},
points={{27.2,0},{-49.4,0},{-49.4,3.45},{-53.2,3.45}},
color={0,0,0}),__MWORKS(BlockSystem(NamedSignal)));
  connect(subSystem3.x_d, subSystem.x_d) 
  annotation(Line(origin={-187,30},
points={{-75.2,7},{-71.4,7},{-71.4,-7},{75.2,-7}},
color={0,0,0}));
  connect(subSystem3.y_d, subSystem.y_d) 
  annotation(Line(origin={-187,12},
points={{-75.2,2.33333},{-71.4,2.33333},{-71.4,-3},{75.2,-3}},
color={0,0,0}));
  connect(subSystem3.z_d, subSystem.z_d) 
  annotation(Line(origin={-187,31},
points={{-75.2,-39.3333},{-3,-39.3333},{-3,34},{75.2,34}},
color={0,0,0}));
  end droneCtrl;